From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CFDC3E7F14F for ; Thu, 28 Sep 2023 00:18:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=x2BLVfeaw6bz6cSbGvb6E9pRbq0S7A436sxY+Crnvm4=; b=3yNf0P97g/DU4k EdHqPOaffS/YITEN9ufqtLKKX1EQSIO33yygzunae6t5HQnfPIutBIkBOuQ1WWH5Q9gALjk0zDaAX cPnzHIaPbkJU84l7lJlckAOYvsmzGwBv45wit1X8rfuf4ShYODFdKoYj7zItmDKV/fbZnSm/Q4Gnl MSrQZiHwTXEQciEgatdjwqOz+7lMfUFjXZHa5IDa+molHTYJyPuLbX7YGfSxmxVD1WNYWBRAMoiap J5DaYKKXpQ8AUCbnhts8gigOJHKMUsmjkpwSJx3KoFhQOqwjgAxch5Mu7RKzHh5bUVtW79RIp4D+v I1Xd60LusKHPuxz3aR0Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qlejD-001zcs-2T; Thu, 28 Sep 2023 00:18:03 +0000 Received: from linux.microsoft.com ([13.77.154.182]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qlej8-001zbt-1T for linux-arm-kernel@lists.infradead.org; Thu, 28 Sep 2023 00:18:02 +0000 Received: from [10.0.0.178] (c-76-135-56-23.hsd1.wa.comcast.net [76.135.56.23]) by linux.microsoft.com (Postfix) with ESMTPSA id C798520B74C0; Wed, 27 Sep 2023 17:17:55 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com C798520B74C0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1695860276; bh=apiqyVomDl3eH58Vs8mK0hqcp1k7lISOy2zAU3jCyNU=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=V8yNq7vak/Kr3K00IoP6fpQzGDvLsvy4Ezk9uAHfe4/mS3eMbtM8AOjTFUAcUd+m8 Uy7bPwEC59miyqW9bO1K2C0BHSiD0UJAdT4igjnaL80svRDmpqu5ZuDj+DfThLWX/d EzQskjEpeqCkesXIudWToBYAWfoOBMOwhSz/l9+M= Message-ID: Date: Wed, 27 Sep 2023 17:17:54 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 15/15] Drivers: hv: Add modules to expose /dev/mshv to VMMs running on Hyper-V Content-Language: en-US To: Greg KH , Wei Liu Cc: linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, patches@lists.linux.dev, mikelley@microsoft.com, kys@microsoft.com, haiyangz@microsoft.com, decui@microsoft.com, apais@linux.microsoft.com, Tianyu.Lan@microsoft.com, ssengar@linux.microsoft.com, mukeshrathor@microsoft.com, stanislav.kinsburskiy@gmail.com, jinankjain@linux.microsoft.com, vkuznets@redhat.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, will@kernel.org, catalin.marinas@arm.com References: <2023092342-staunch-chafe-1598@gregkh> <2023092630-masculine-clinic-19b6@gregkh> <2023092614-tummy-dwelling-7063@gregkh> <2023092646-version-series-a7b5@gregkh> <05119cbc-155d-47c5-ab21-e6a08eba5dc4@linux.microsoft.com> <2023092737-daily-humility-f01c@gregkh> <2023092757-cupbearer-cancel-b314@gregkh> From: Nuno Das Neves In-Reply-To: <2023092757-cupbearer-cancel-b314@gregkh> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230927_171758_542696_A9A918AA X-CRM114-Status: GOOD ( 14.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel