Re: [PATCH v13 1/3] x86/tdx: Add TDX Guest attestation interface driver

From: Sathyanarayanan Kuppuswamy
Date: Mon Sep 12 2022 - 22:44:39 EST




On 9/12/22 6:25 PM, Huang, Kai wrote:
>> diff --git a/arch/x86/coco/tdx/tdx.c b/arch/x86/coco/tdx/tdx.c
>> index 928dcf7a20d9..8b5c59110321 100644
>> --- a/arch/x86/coco/tdx/tdx.c
>> +++ b/arch/x86/coco/tdx/tdx.c
>> @@ -5,16 +5,21 @@
>>  #define pr_fmt(fmt)     "tdx: " fmt
>>  
>>  #include <linux/cpufeature.h>
>> +#include <linux/miscdevice.h>
>> +#include <linux/mm.h>
>> +#include <linux/io.h>
> Sorry perhaps I am missing something, but what is the reason to include
> <linux/mm.h>?

It is included for kmalloc/kfree, file related structs and copy_{from|to}_user().

>
> <linux/io.h> is for virt_to_phys()?

Yes

>
> And should we explicitly include <linux/uaccess.h> for copy_{from|to}_user(),

mm.h covers it. So I don't think we should explicitly include it.

> and include the header (<linux/string.h> ?) for memchr_inv()?

One of the previous headers includes linux/string.h (I am not sure which one).
So why include it explicitly?

--
Sathyanarayanan Kuppuswamy
Linux Kernel Developer