On Thu, Jul 14, 2022 at 12:22:36PM +0200, Jan Beulich wrote: > On 06.07.2022 17:32, Marek Marczykowski-Górecki wrote: > > --- a/xen/drivers/passthrough/amd/iommu_acpi.c > > +++ b/xen/drivers/passthrough/amd/iommu_acpi.c > > @@ -1078,6 +1078,20 @@ static inline bool_t is_ivmd_block(u8 type) > > type == ACPI_IVRS_TYPE_MEMORY_IOMMU); > > } > > > > +static int __init cf_check add_one_extra_ivmd(xen_pfn_t start, xen_ulong_t > > nr, u32 id, void *ctxt) > > +{ > > + struct acpi_ivrs_memory ivmd; > > + > > + ivmd.start_address = start << PAGE_SHIFT; > > + ivmd.memory_length = nr << PAGE_SHIFT; > > Aren't these at risk of truncation on 32-bit architectures? We have > suitable wrappers for such conversions, avoiding such issues.
Well, this (and the vtd equivalent) is x86-only, so it's always 64-bit. Anyway, what are those wrappers? > > + ivmd.header.flags = ACPI_IVMD_UNITY | > > + ACPI_IVMD_READ | ACPI_IVMD_WRITE; > > + ivmd.header.length = sizeof(ivmd); > > + ivmd.header.device_id = id; > > + ivmd.header.type = ACPI_IVRS_TYPE_MEMORY_ONE; > > Please make these the variable's initializer. > > Jan -- Best Regards, Marek Marczykowski-Górecki Invisible Things Lab
signature.asc
Description: PGP signature