[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 7/9] IOMMU/AMD: wire common device reserved memory API
- To: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Thu, 14 Jul 2022 12:22:36 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Q8OpmW4MgrVn+Wl2J7lABTGUu0w2yPM03XOTyhPALbw=; b=mzqpuLbpKaUPKOzdycKm2zp69LhzSUHwwy/6EeeMXkzTjrsBMDuL03lrhWerPFQoRx6ehesRHziB42kB4Zv2oNiqfW1/YUBre6TEaAinoaSLrnoVJg2OFJ9Lr/ywyB4e+hML0RVZcJXQ4d72xAWJA+aLdUx7A0G/tHDEfxy6+8FzE92e1wmSKq9s1t4eneu0mJM1Vbz0xbuxp31WRgn5qh23KxCA0AvehHIgdiIMcDvKM88YwatzovKX24iT+HBpJcic/XOWQ/MJDIAwvtmAS7tjzlKOaMSgUFEdmHyV36GNk7VBl62pPdG3ZKRC0Va+CssP18XU80Es5C+0FMSYhw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G96STHvvt+V3ZJDvdHwpkHE+uCVngx+seSLqVAUN9rAe9gsO05BNLRPs5mnFAT69V98kBYKtlGFpsktIvxlXBEYYIjPjnHqen2zvbDe50eBfxclzjdmxG3eXzYPzGRKU5h4okwvvT7JqyRAPJPB2m9C6peeeiIjzUdZ59ZmJaSDaPKb9CXEoIqRnxqmBJgNOKJ1/g1e0L8Zgq4KhW26CBxXEWOONfqKr4Fqp0AdGocTVaRzgc0/7YXel9/3RtIAp8E5gToinjptjhNj+X8GKAnbjAlanQv7CDUV4zYL17Ieabj6svYkg91dcdRNQye4Bxgjzp7pxo+YMzR+M0YPIiQ==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Thu, 14 Jul 2022 10:22:41 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
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.
> + 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
|