Changeset 66270 in vbox for trunk/src/VBox
- Timestamp:
- Mar 27, 2017 6:33:42 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/MsiCommon.cpp
r64454 r66270 7 7 8 8 /* 9 * Copyright (C) 2010-201 6Oracle Corporation9 * Copyright (C) 2010-2017 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 43 43 } 44 44 45 /** @todo r=klaus This design assumes that the config space cache is always 46 * up to date, which is a wrong assumption for the "emulate passthrough" case 47 * where only the callbacks give the correct data. */ 45 48 DECLINLINE(uint32_t*) msiGetMaskBits(PPDMPCIDEV pDev) 46 49 { 47 50 uint8_t iOff = msiIs64Bit(pDev) ? VBOX_MSI_CAP_MASK_BITS_64 : VBOX_MSI_CAP_MASK_BITS_32; 48 /* passthroughdevices may have no masked/pending support */51 /* devices may have no masked/pending support */ 49 52 if (iOff >= pDev->Int.s.u8MsiCapSize) 50 53 return NULL; … … 53 56 } 54 57 58 /** @todo r=klaus This design assumes that the config space cache is always 59 * up to date, which is a wrong assumption for the "emulate passthrough" case 60 * where only the callbacks give the correct data. */ 55 61 DECLINLINE(uint32_t*) msiGetPendingBits(PPDMPCIDEV pDev) 56 62 { 57 63 uint8_t iOff = msiIs64Bit(pDev) ? VBOX_MSI_CAP_PENDING_BITS_64 : VBOX_MSI_CAP_PENDING_BITS_32; 58 /* passthroughdevices may have no masked/pending support */64 /* devices may have no masked/pending support */ 59 65 if (iOff >= pDev->Int.s.u8MsiCapSize) 60 66 return NULL; … … 215 221 uint8_t iNextOffset = pMsiReg->iMsiNextOffset; 216 222 bool f64bit = pMsiReg->fMsi64bit; 223 bool fNoMasking = pMsiReg->fMsiNoMasking; 217 224 uint16_t iFlags = 0; 218 int iMmc;219 220 /* Compute multiple-message capable bitfield */221 for (iMmc = 0; iMmc < 6; iMmc++)222 {223 if ((1 << iMmc) >= cVectors)224 break;225 }226 227 if ((cVectors > VBOX_MSI_MAX_ENTRIES) || (1 << iMmc) < cVectors)228 return VERR_TOO_MUCH_DATA;229 225 230 226 Assert(iCapOffset != 0 && iCapOffset < 0xff && iNextOffset < 0xff); 231 227 232 /* We always support per-vector masking */ 233 iFlags |= VBOX_PCI_MSI_FLAGS_MASKBIT | iMmc; 228 if (!fNoMasking) 229 { 230 int iMmc; 231 232 /* Compute multiple-message capable bitfield */ 233 for (iMmc = 0; iMmc < 6; iMmc++) 234 { 235 if ((1 << iMmc) >= cVectors) 236 break; 237 } 238 239 if ((cVectors > VBOX_MSI_MAX_ENTRIES) || (1 << iMmc) < cVectors) 240 return VERR_TOO_MUCH_DATA; 241 242 /* We support per-vector masking */ 243 iFlags |= VBOX_PCI_MSI_FLAGS_MASKBIT; 244 /* How many vectors we're capable of */ 245 iFlags |= iMmc; 246 } 247 else 248 AssertReturn(cVectors == 1, VERR_TOO_MUCH_DATA); 249 234 250 if (f64bit) 235 251 iFlags |= VBOX_PCI_MSI_FLAGS_64BIT; 236 /* How many vectors we're capable of */237 iFlags |= iMmc;238 252 239 253 pDev->Int.s.u8MsiCapOffset = iCapOffset; … … 244 258 PCIDevSetWord(pDev, iCapOffset + VBOX_MSI_CAP_MESSAGE_CONTROL, iFlags); 245 259 246 *msiGetMaskBits(pDev) = 0; 247 *msiGetPendingBits(pDev) = 0; 260 if (!fNoMasking) 261 { 262 *msiGetMaskBits(pDev) = 0; 263 *msiGetPendingBits(pDev) = 0; 264 } 248 265 249 266 pciDevSetMsiCapable(pDev); 267 if (f64bit) 268 pciDevSetMsi64Capable(pDev); 250 269 251 270 return VINF_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.