On Wed, Dec 07, 2016 at 01:52:45PM +0800, Peter Xu wrote: > Previously vt-d codes only supports 39 bits iova address width. It won't > be hard to extend it to 48 bits. > > After enabling this, we should be able to map larger iova addresses. > > To check whether 48 bits aw is enabled, we can grep in the guest dmesg > with line: "dmar: Host address width 48" (previously it was 39). > > Signed-off-by: Peter Xu <pet...@redhat.com>
I suspect we can't do this for old machine types. Need to behave in compatible ways. Also, is 48 always enough? 5 level with 57 bits is just around the corner. And is it always supported? for things like vfio to work, don't we need to check what does host support? > --- > hw/i386/intel_iommu_internal.h | 5 +++-- > include/hw/i386/intel_iommu.h | 2 +- > 2 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h > index e808c67..00e1e16 100644 > --- a/hw/i386/intel_iommu_internal.h > +++ b/hw/i386/intel_iommu_internal.h > @@ -195,7 +195,7 @@ > #define VTD_DOMAIN_ID_SHIFT 16 /* 16-bit domain id for 64K domains > */ > #define VTD_DOMAIN_ID_MASK ((1UL << VTD_DOMAIN_ID_SHIFT) - 1) > #define VTD_CAP_ND (((VTD_DOMAIN_ID_SHIFT - 4) / 2) & 7ULL) > -#define VTD_MGAW 39 /* Maximum Guest Address Width */ > +#define VTD_MGAW 48 /* Maximum Guest Address Width */ > #define VTD_CAP_MGAW (((VTD_MGAW - 1) & 0x3fULL) << 16) > #define VTD_MAMV 18ULL > #define VTD_CAP_MAMV (VTD_MAMV << 48) > @@ -209,7 +209,8 @@ > #define VTD_CAP_SAGAW_39bit (0x2ULL << VTD_CAP_SAGAW_SHIFT) > /* 48-bit AGAW, 4-level page-table */ > #define VTD_CAP_SAGAW_48bit (0x4ULL << VTD_CAP_SAGAW_SHIFT) > -#define VTD_CAP_SAGAW VTD_CAP_SAGAW_39bit > +#define VTD_CAP_SAGAW (VTD_CAP_SAGAW_39bit | \ > + VTD_CAP_SAGAW_48bit) > > /* IQT_REG */ > #define VTD_IQT_QT(val) (((val) >> 4) & 0x7fffULL) > diff --git a/include/hw/i386/intel_iommu.h b/include/hw/i386/intel_iommu.h > index 405c9d1..8e0fe65 100644 > --- a/include/hw/i386/intel_iommu.h > +++ b/include/hw/i386/intel_iommu.h > @@ -44,7 +44,7 @@ > #define VTD_SID_TO_DEVFN(sid) ((sid) & 0xff) > > #define DMAR_REG_SIZE 0x230 > -#define VTD_HOST_ADDRESS_WIDTH 39 > +#define VTD_HOST_ADDRESS_WIDTH 48 > #define VTD_HAW_MASK ((1ULL << VTD_HOST_ADDRESS_WIDTH) - 1) > > #define DMAR_REPORT_F_INTR (1) > -- > 2.7.4