[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <fda2a3dd-b325-4780-bd02-d1fedcaec260@linux.microsoft.com>
Date: Wed, 27 Sep 2023 17:17:54 -0700
From: Nuno Das Neves <nunodasneves@...ux.microsoft.com>
To: Greg KH <gregkh@...uxfoundation.org>, Wei Liu <wei.liu@...nel.org>
Cc: linux-hyperv@...r.kernel.org, linux-kernel@...r.kernel.org,
x86@...nel.org, linux-arm-kernel@...ts.infradead.org,
linux-arch@...r.kernel.org, patches@...ts.linux.dev,
mikelley@...rosoft.com, kys@...rosoft.com, haiyangz@...rosoft.com,
decui@...rosoft.com, apais@...ux.microsoft.com,
Tianyu.Lan@...rosoft.com, ssengar@...ux.microsoft.com,
mukeshrathor@...rosoft.com, stanislav.kinsburskiy@...il.com,
jinankjain@...ux.microsoft.com, vkuznets@...hat.com,
tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
dave.hansen@...ux.intel.com, hpa@...or.com, will@...nel.org,
catalin.marinas@....com
Subject: Re: [PATCH v3 15/15] Drivers: hv: Add modules to expose /dev/mshv to
VMMs running on Hyper-V
On 9/27/2023 1:33 AM, Greg KH wrote:
> On Wed, Sep 27, 2023 at 08:04:42AM +0000, Wei Liu wrote:
>> So, the driver is supposed to stash a pointer to struct device in
>> private_data. That's what I alluded to in my previous reply. The core
>> driver framework or the VFS doesn't give us a reference to struct
>> device. We have to do it ourselves.
>
> Please read Linux Device Drivers, 3rd edition, chapter 3, for how to do
> this properly. The book is free online.
>
Thanks, the issue that confused us was how to get the miscdevice.
I eventually found the answer in the misc_register() documentation:
"By default, an open() syscall to the device sets file->private_data to
point to the structure."
That's good - when we create a guest, we will have the miscdevice
in private_data already. Then we can just put it in our per-guest data
structure. That will let us retrieve the device in the other ioctls so
we can call dev_*().
Thanks,
Nuno
Powered by blists - more mailing lists