[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: Mon, 18 Jul 2022 13:44:39 +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=hRwopZa8W3JKHcoInQtQujPiQ1LWAhBAeND4hEXgBvw=; b=Lr8U3IghAJHLINDNKXCYD8JXbtvjO1d+DsvIfH0A81hwDg/MjuAVgKkM7VYOWVgVFTlqNDK7iOWgf6E/f+SSGW+zsrheg7r9WE1FOx9cm0GvE0WnVbgRo6BJ2lX0X/bzVJav69s9mS0biW+n/UIFnXATzD41dt7BZu2AAUmAjP7BUOqn+OiOczKhdGxNDip72qrKQqABeTu3XYch+EbyzbnziOCRKQrdL+TocdCYNKj9Zqurl51a36HiGiJGT6YlKogeHEVsWMDnn+pYia8OLWCLMBkN8YnSeApFEjbh/2rDEApfno75u7fVvXNtgB/riCe71phFwmI+5fUXLkpg4A==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OHh6RkuHRK78yw8ZkF5bLC164JEB11ktcMRW0fK/kahUKxzAvqE/A13GD6hAoJVVf+ipknzg7SxlylQRTap2D4GJ0WzUi1OLuDQYIV7nH9FwB0N4aciMkpA55LZ6S/aVsbddAA3TX36PMix1qVUm09AphNyefSxU1h12Si4x48jzquHjddqTe0o8/swFk4TAYs4ShIcIhSHi8LZKk7gTcwjnTswuUlFa2qEUdOhnGg9oXuEnOrSyrYW5+juzj/5F5isO5Ww71O+oDOzTki6kKexLptLR0d6ttEob2aAZXDi2bqdXCqEa1l4y7GIlbylab7lqJSfOw0tZcVZXnH/Jdw==
- 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: Mon, 18 Jul 2022 11:44:50 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 18.07.2022 13:35, Marek Marczykowski-Górecki wrote:
> 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.
Nevertheless writing things cleanly everywhere will reduce the risk of
somebody cloning this code on the assumption that it's correct.
> Anyway, what are those wrappers?
pfn_to_paddr()
Jan
|