VirtualBox

Changeset 78509 in vbox


Ignore:
Timestamp:
May 14, 2019 3:16:21 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
130549
Message:

Main/Machine+StorageController+SystemProperties+Console: Add basic support for virtio-scsi storage controller.

Location:
trunk/src/VBox/Main
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r78485 r78509  
    598598    <const name="v1_17" value="19">
    599599      <desc>Settings version "1.17", written by VirtualBox 6.0.x.</desc>
     600      <!--
     601          Machine changes: nested hardware virtualization, UART type selection.
     602      -->
     603    </const>
     604    <const name="v1_18" value="20">
     605      <desc>Settings version "1.18", written by VirtualBox 6.1.x.</desc>
    600606      <!--
    601607          Machine changes: nested hardware virtualization, UART type selection.
     
    2171421720  <enum
    2171521721    name="StorageBus"
    21716     uuid="21371490-8542-4b5a-a74d-ee9ac2d45a90"
     21722    uuid="f9510869-7d07-46ba-96a6-6728fbf4adee"
    2171721723    >
    2171821724    <desc>
     
    2173021736    <const name="USB"       value="6"/>
    2173121737    <const name="PCIe"      value="7"/>
     21738    <const name="VirtioSCSI" value="8"/>
    2173221739  </enum>
    2173321740
    2173421741  <enum
    2173521742    name="StorageControllerType"
    21736     uuid="9427f309-82e7-468f-9964-abfefc4d3058"
     21743    uuid="a77d457d-66a3-4368-b24c-293d0f562a9f"
    2173721744    >
    2173821745    <desc>
     
    2177321780    <const name="NVMe"          value="10">
    2177421781      <desc>An NVMe storage controller.</desc>
     21782    </const>
     21783    <const name="VirtioSCSI"    value="11">
     21784      <desc>Virtio SCSI storage controller.</desc>
    2177521785    </const>
    2177621786  </enum>
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r78261 r78509  
    984984        iLedNvme    = iLedUsb + cLedUsb,
    985985        cLedNvme    = 30,
    986         cLedStorage = cLedFloppy + cLedIde + cLedSata + cLedScsi + cLedSas + cLedUsb + cLedNvme
     986        iLedVirtio  = iLedNvme + cLedNvme,
     987        cLedVirtio  = 16,
     988        cLedStorage = cLedFloppy + cLedIde + cLedSata + cLedScsi + cLedSas + cLedUsb + cLedNvme + cLedVirtio
    987989    };
    988990    DeviceType_T maStorageDevType[cLedStorage];
  • trunk/src/VBox/Main/src-client/BusAssignmentManager.cpp

    r76553 r78509  
    7272    {"lsilogicsas",   0, 22, 0,  1},
    7373    {"nvme",          0, 14, 0,  1},
     74    {"virtio-scsi",   0, 15, 0,  1},
    7475
    7576    /* USB controllers */
     
    204205    {"nic",           2, 31, 0,   0},
    205206
    206     /* Storage controller #2 (NVMe) */
     207    /* Storage controller #2 (NVMe, virtio-scsi) */
    207208    {"nvme",          3,  0, 0,   0},
    208209    {"nvme",          3,  1, 0,   0},
     
    212213    {"nvme",          3,  5, 0,   0},
    213214    {"nvme",          3,  6, 0,   0},
     215    {"virtio-scsi",   3,  7, 0,   0},
     216    {"virtio-scsi",   3,  8, 0,   0},
     217    {"virtio-scsi",   3,  9, 0,   0},
     218    {"virtio-scsi",   3, 10, 0,   0},
     219    {"virtio-scsi",   3, 11, 0,   0},
     220    {"virtio-scsi",   3, 12, 0,   0},
     221    {"virtio-scsi",   3, 13, 0,   0},
    214222
    215223    { NULL,          -1, -1, -1,  0}
     
    226234    {"buslogic",    "storage"},
    227235    {"lsilogicsas", "storage"},
    228     {"nvme",        "storage"}
     236    {"nvme",        "storage"},
     237    {"virtio-scsi", "storage"}
    229238};
    230239
  • trunk/src/VBox/Main/src-client/ConsoleImpl.cpp

    r78261 r78509  
    33103310        case StorageControllerType_NVMe:
    33113311            return "nvme";
     3312        case StorageControllerType_VirtioSCSI:
     3313            return "virtio-scsi";
    33123314        default:
    33133315            return NULL;
     
    33313333        case StorageBus_SAS:
    33323334        case StorageBus_PCIe:
     3335        case StorageBus_VirtioSCSI:
    33333336        {
    33343337            uLun = port;
  • trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp

    r78093 r78509  
    21352135         */
    21362136        com::SafeIfaceArray<IStorageController> ctrls;
    2137         PCFGMNODE aCtrlNodes[StorageControllerType_NVMe + 1] = {};
     2137        PCFGMNODE aCtrlNodes[StorageControllerType_VirtioSCSI + 1] = {};
    21382138        hrc = pMachine->COMGETTER(StorageControllers)(ComSafeArrayAsOutParam(ctrls));       H();
    21392139
     
    23922392                                       &mapMediumAttachments, pszCtrlDev, ulInstance);
    23932393                    paLedDevType = &maStorageDevType[iLedNvme];
     2394                    break;
     2395                }
     2396
     2397                case StorageControllerType_VirtioSCSI:
     2398                {
     2399                    hrc = pBusMgr->assignPCIDevice("virtio-scsi", pCtlInst);                H();
     2400
     2401                    ULONG cPorts = 0;
     2402                    hrc = ctrls[i]->COMGETTER(PortCount)(&cPorts);                          H();
     2403                    InsertConfigInteger(pCfg, "NumTargets", cPorts);
     2404
     2405                    /* Attach the status driver */
     2406                    AssertRelease(cPorts <= cLedSata);
     2407                    i_attachStatusDriver(pCtlInst, &mapStorageLeds[iLedVirtio], 0, cPorts - 1,
     2408                                       &mapMediumAttachments, pszCtrlDev, ulInstance);
     2409                    paLedDevType = &maStorageDevType[iLedVirtio];
    23942410                    break;
    23952411                }
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r78427 r78509  
    60006000{
    60016001    if (   (aConnectionType <= StorageBus_Null)
    6002         || (aConnectionType >  StorageBus_PCIe))
     6002        || (aConnectionType >  StorageBus_VirtioSCSI))
    60036003        return setError(E_INVALIDARG,
    60046004                        tr("Invalid connection type: %d"),
  • trunk/src/VBox/Main/src-server/StorageControllerImpl.cpp

    r78261 r78509  
    9696    ComAssertRet(aParent && !aName.isEmpty(), E_INVALIDARG);
    9797    if (   (aStorageBus <= StorageBus_Null)
    98         || (aStorageBus >  StorageBus_PCIe))
     98        || (aStorageBus >  StorageBus_VirtioSCSI))
    9999        return setError(E_INVALIDARG,
    100100                        tr("Invalid storage connection type"));
     
    162162            m->bd->ulPortCount = 1;
    163163            m->bd->controllerType = StorageControllerType_NVMe;
     164            break;
     165        case StorageBus_VirtioSCSI:
     166            m->bd->ulPortCount = 1;
     167            m->bd->controllerType = StorageControllerType_VirtioSCSI;
    164168            break;
    165169        case StorageBus_Null: break; /* Shut up MSC. */
     
    415419            break;
    416420        }
     421        case StorageBus_VirtioSCSI:
     422        {
     423            if (aControllerType != StorageControllerType_VirtioSCSI)
     424                rc = E_INVALIDARG;
     425            break;
     426        }
    417427        default:
    418428            AssertMsgFailed(("Invalid controller type %d\n", m->bd->storageBus));
     
    560570                                tr("Invalid port count: %lu (must be in range [%lu, %lu])"),
    561571                                aPortCount, 1, 255);
     572            break;
     573        }
     574        case StorageBus_VirtioSCSI:
     575        {
     576            /*
     577             * virtio-scsi supports 256 targets (with 16384 LUNs each).
     578             */
     579            if (aPortCount < 1 || aPortCount > 256)
     580                return setError(E_INVALIDARG,
     581                                tr("Invalid port count: %lu (must be in range [%lu, %lu])"),
     582                                aPortCount, 1, 256);
    562583            break;
    563584        }
  • trunk/src/VBox/Main/src-server/SystemPropertiesImpl.cpp

    r76592 r78509  
    363363        case StorageBus_USB:
    364364        case StorageBus_PCIe:
     365        case StorageBus_VirtioSCSI:
    365366        {
    366367            /* SATA and both SCSI controllers only support one device per port. */
     
    392393        case StorageBus_SAS:
    393394        case StorageBus_PCIe:
     395        case StorageBus_VirtioSCSI:
    394396        {
    395397            *aMinPortCount = 1;
     
    458460        {
    459461            *aMaxPortCount = 8;
     462            break;
     463        }
     464        case StorageBus_VirtioSCSI:
     465        {
     466            *aMaxPortCount = 256;
    460467            break;
    461468        }
     
    480487        case StorageBus_SAS:
    481488        case StorageBus_PCIe:
     489        case StorageBus_VirtioSCSI:
    482490            cCtrs = aChipset == ChipsetType_ICH9 ? 8 : 1;
    483491            break;
     
    511519        case StorageBus_SAS:
    512520        case StorageBus_USB:
     521        case StorageBus_VirtioSCSI:
    513522        {
    514523            aDeviceTypes.resize(2);
     
    548557        case StorageControllerType_USB:
    549558        case StorageControllerType_NVMe:
     559        case StorageControllerType_VirtioSCSI:
    550560            *aEnabled = false;
    551561            break;
     
    575585        case StorageControllerType_BusLogic:
    576586        case StorageControllerType_NVMe:
     587        case StorageControllerType_VirtioSCSI:
    577588        case StorageControllerType_PIIX3:
    578589        case StorageControllerType_PIIX4:
  • trunk/src/VBox/Main/xml/Settings.cpp

    r77910 r78509  
    411411            else if (ulMinor == 17)
    412412                sv = SettingsVersion_v1_17;
    413             else if (ulMinor > 17)
     413            else if (ulMinor == 18)
     414                sv = SettingsVersion_v1_18;
     415            else if (ulMinor > 18)
    414416                sv = SettingsVersion_Future;
    415417        }
     
    10401042            break;
    10411043
     1044        case SettingsVersion_v1_18:
     1045            pcszVersion = "1.18";
     1046            break;
     1047
    10421048        default:
    10431049            // catch human error: the assertion below will trigger in debug
     
    10621068                // but as it's an omission of someone who changed this file
    10631069                // it's the only generic possibility.
    1064                 pcszVersion = "1.17";
    1065                 m->sv = SettingsVersion_v1_17;
     1070                pcszVersion = "1.18";
     1071                m->sv = SettingsVersion_v1_18;
    10661072            }
    10671073            break;
     
    50355041            sctl.controllerType = StorageControllerType_NVMe;
    50365042        }
     5043        else if (strType == "VirtioSCSI")
     5044        {
     5045            sctl.storageBus = StorageBus_VirtioSCSI;
     5046            sctl.controllerType = StorageControllerType_VirtioSCSI;
     5047        }
    50375048        else
    50385049            throw ConfigFileError(this, pelmController, N_("Invalid value '%s' for StorageController/@type attribute"), strType.c_str());
     
    68686879            case StorageControllerType_USB: pcszType = "USB"; break;
    68696880            case StorageControllerType_NVMe: pcszType = "NVMe"; break;
     6881            case StorageControllerType_VirtioSCSI: pcszType = "VirtioSCSI"; break;
    68706882            default: /*case StorageControllerType_PIIX3:*/ pcszType = "PIIX3"; break;
    68716883        }
     
    73607372void MachineConfigFile::bumpSettingsVersionIfNeeded()
    73617373{
     7374    if (m->sv < SettingsVersion_v1_18)
     7375    {
     7376        // VirtualBox 6.1 adds a virtio-scsi storage controller.
     7377        for (StorageControllersList::const_iterator it = hardwareMachine.storage.llStorageControllers.begin();
     7378             it != hardwareMachine.storage.llStorageControllers.end();
     7379             ++it)
     7380        {
     7381            const StorageController &sctl = *it;
     7382
     7383            if (sctl.controllerType == StorageControllerType_VirtioSCSI)
     7384            {
     7385                m->sv = SettingsVersion_v1_18;
     7386                return;
     7387            }
     7388        }
     7389    }
     7390
    73627391    if (m->sv < SettingsVersion_v1_17)
    73637392    {
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette