Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp2160675lqe; Tue, 9 Apr 2024 11:09:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU/eHpO3nq7PWjepHelJiSUymlDdB5c3uYCltWlkH1dqNm7taP59MrQoNaEJWmRpthel4NVHSR4N4V8d9AoCmWJgcRrmIaguOvM46xfbg== X-Google-Smtp-Source: AGHT+IEWvUaLUpSm9P8wJCECUcTuL0cmaDi++WXU1v+wLrYAT/kvICqAF8l3CWwsl7D/TrXc17cF X-Received: by 2002:a9d:7514:0:b0:6e7:47:2abd with SMTP id r20-20020a9d7514000000b006e700472abdmr546693otk.16.1712686152148; Tue, 09 Apr 2024 11:09:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712686152; cv=pass; d=google.com; s=arc-20160816; b=EHJ2xLfVQJCJDEa1LKdoDIhkBvCpIlkB/2S0WMuIUEhdJb8WE6t4uz109aA5SEXaic olv4gdlgutl6OaLsQIhG5i+apJ//QVh9WfGrAjbATgltexC6uBMn/1f9mOnBY1T6B3dO ZgyO7fhEj//nKtBMdCx+trgxjAysztDVzwZtww7xbzH5eD3kjgvMbYg1xmVCOyrd4fon x99jS8NqLHXQQGyVERvaWa8acZeLGRZEyKN+mAamFoYU1a6NgM0D2VzXjXd+xi43yCfV +FfdmxMoKtdJp/y5VT2EKcTjXE5czTh+B2FJ+m8Yp53oPE1OyO4qUJkmGuq2ghTyMyne 3KUA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=rBBGVVbWyG53Bo0BvWtj1B8Zl74l3cqMo25WQ4bR+gY=; fh=k/6iF/FVpQwbXL/FmEXvHb1VTlcX0UURzggYTUBmovI=; b=Poo747og764opnKOf6TGIlw0fiERcKZk/c8G8EN5XrzpkC8uR4PXjVmnd23BECHMXR Y4IadDwmhfXzZaf3gVTjHRMcWTf1MYCWTxFBucoLdf1DU5/VonOEBBt6qdxD+2NYd+6q ffbeXi3pUHr/Xac6u1+INL1DYlnHTH0TGfqIkYTMyQAO6wfHVLKfnRigqBbJJhSekKeV V7sTQ5N/vcFjhOvFkapKf/irdVfgDsZAssjevezJ3YCpREh96aF5JhQ7qFxo8BoKP3y+ n3JYcqm8dMIDkJRhkLrnUWsgjJYbMESQPGQk3+zrYC5HT/cW2SkAiITn9BPS8ZukZr7d Z2OQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amazon.co.uk header.s=amazon201209 header.b=A5RPqkmx; arc=pass (i=1 spf=pass spfdomain=amazon.co.uk dkim=pass dkdomain=amazon.co.uk dmarc=pass fromdomain=amazon.co.uk); spf=pass (google.com: domain of linux-kernel+bounces-137442-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137442-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.co.uk Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id h6-20020a0cf8c6000000b00699406d8904si10583813qvo.228.2024.04.09.11.09.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 11:09:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-137442-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.co.uk header.s=amazon201209 header.b=A5RPqkmx; arc=pass (i=1 spf=pass spfdomain=amazon.co.uk dkim=pass dkdomain=amazon.co.uk dmarc=pass fromdomain=amazon.co.uk); spf=pass (google.com: domain of linux-kernel+bounces-137442-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137442-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.co.uk Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id AFFE51C20FC4 for ; Tue, 9 Apr 2024 18:09:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 57F21156883; Tue, 9 Apr 2024 18:09:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amazon.co.uk header.i=@amazon.co.uk header.b="A5RPqkmx" Received: from smtp-fw-80008.amazon.com (smtp-fw-80008.amazon.com [99.78.197.219]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B786156654; Tue, 9 Apr 2024 18:09:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=99.78.197.219 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712686144; cv=none; b=JCJlb6cWdIGf5J3cDfmoSkGDWeHVVOe0ZRaAoj0b24NmmJVrxZYF1L6xD4w+FVxq83cbbB3TeZKBLDTvRh9OaXzFbTEipyC3Ye/ad0WmHTfEsBTmDB2UYUWswdELcO0M3yfx8f+cwXJUUPFHQOmACZ3b+jDrnoBdQv+Nw4CJEsY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712686144; c=relaxed/simple; bh=+Q/xe7QnEzn9MjGrM5tNgUQ+yK/3YTW1NzW8iBLHM3A=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=Go97k2gVdUwdbZ7pideV+iHLQMLpxuNVdwgCCAwWFCpDagtiGUyHLna07lw4rhfQiAg2N/fKBE59ss/iPkoR15Lnmjc2K4ZLKvYss13IfUXfoJPrxM7VJwr93s6exGMhvbhpkXRdgMo4qsakAPM2D7A01xHOwHz5p1k0SN1saYQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.co.uk; spf=pass smtp.mailfrom=amazon.co.uk; dkim=pass (1024-bit key) header.d=amazon.co.uk header.i=@amazon.co.uk header.b=A5RPqkmx; arc=none smtp.client-ip=99.78.197.219 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.co.uk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.co.uk DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.co.uk; i=@amazon.co.uk; q=dns/txt; s=amazon201209; t=1712686142; x=1744222142; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=rBBGVVbWyG53Bo0BvWtj1B8Zl74l3cqMo25WQ4bR+gY=; b=A5RPqkmx+fB3YfTqDAj/xf4fBTeWrt8Nr3brQRzgxenXMrWw4Dy86w6G r4Gb3TXNPeYt0hYR4TA0FbOiNtNA3GG63CRypPUPciYW6pZtXKezTBovm xdCIYN98VQoaM2vyGjLvI1lgmYSjtaR3nfWWvGuyNmWxmAQCg1UaAAbeq Y=; X-IronPort-AV: E=Sophos;i="6.07,190,1708387200"; d="scan'208";a="79878578" Received: from pdx4-co-svc-p1-lb2-vlan3.amazon.com (HELO smtpout.prod.us-west-2.prod.farcaster.email.amazon.dev) ([10.25.36.214]) by smtp-border-fw-80008.pdx80.corp.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Apr 2024 18:09:00 +0000 Received: from EX19MTAEUA001.ant.amazon.com [10.0.17.79:19349] by smtpin.naws.eu-west-1.prod.farcaster.email.amazon.dev [10.0.37.241:2525] with esmtp (Farcaster) id f9279dda-5448-4f1c-a4d9-bd484090a88f; Tue, 9 Apr 2024 18:08:59 +0000 (UTC) X-Farcaster-Flow-ID: f9279dda-5448-4f1c-a4d9-bd484090a88f Received: from EX19D036EUC002.ant.amazon.com (10.252.61.191) by EX19MTAEUA001.ant.amazon.com (10.252.50.50) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.28; Tue, 9 Apr 2024 18:08:59 +0000 Received: from [10.95.97.144] (10.95.97.144) by EX19D036EUC002.ant.amazon.com (10.252.61.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.28; Tue, 9 Apr 2024 18:08:54 +0000 Message-ID: <2ecfc189-92fd-4575-a9e4-c8a5cf2923fa@amazon.co.uk> Date: Tue, 9 Apr 2024 19:08:54 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 0/5] virt: vmgenid: Add devicetree bindings support Content-Language: en-US To: Sudan Landge , , , , , , , , , , CC: , , , References: <20240409170137.79197-1-sudanl@amazon.com> From: "Landge, Sudan" In-Reply-To: <20240409170137.79197-1-sudanl@amazon.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: EX19D032UWB001.ant.amazon.com (10.13.139.152) To EX19D036EUC002.ant.amazon.com (10.252.61.191) On 09/04/2024 18:01, Sudan Landge wrote: > This small series of patches aims to add devicetree bindings support for > the Virtual Machine Generation ID (vmgenid). > > Virtual Machine Generation ID was introduced in commit af6b54e2b5ba > ("virt: vmgenid: notify RNG of VM fork and supply generation ID") as an > ACPI only device. > > VMGenID specification http://go.microsoft.com/fwlink/?LinkId=260709 defines > a mechanism for the BIOS/hypervisors to communicate to the virtual machine > that it is executed with a different configuration (e.g. snapshot execution > or creation from a template). > The guest operating system can use the notification for various purposes > such as re-initializing its random number generator etc. > > More references to vmgenid specs: > - https://www.qemu.org/docs/master/specs/vmgenid.html > - https://learn.microsoft.com/en-us/windows/win32/hyperv_v2/ > virtual-machine-generation-identifier > > *Reason for this change*: > Chosing ACPI or devicetree is an intrinsic part of an hypervisor design. > Without going into details of why a hypervisor would choose DT over ACPI, > we would like to highlight that the hypervisors that have chosen devicetree > and now want to make use of the vmgenid functionality cannot do so today > because vmgenid is an ACPI only device. > This forces these hypervisors to change their design which could have > undesirable impacts on their use-cases, test-scenarios etc. > > vmgenid exposes to the guest a 16-byte cryptographically random number, > the value of which changes every time it starts executing from a new > configuration (snapshot, backup, etc.). During initialization, the device > exposes to the guest the address of the generation ID and > an interrupt number, which the device will use to notify the guest when > the generation ID changes. > These attributes can be trivially communicated via device tree bindings. > > We believe that adding a devicetree binding for vmgenid is a simpler > alternative way to expose the device to the guest than forcing the > hypervisors to implement ACPI. > > Addtional notes: > While adding the devicetree support we considered re-using existing > structures/code to avoid duplicating code and reduce maintenance; so, > we used the same driver to be configured either by ACPI or by DT. > This also meant reimplementing the existing vmgenid ACPI bus driver as a > platform driver and making it discoverable using `driver.of_match_table` > and `driver.acpi_match_table`. > > There is no user impact or change in vmgenid functionality when used > with ACPI. We verified ACPI support of these patches on X86 and DT > support on ARM using Firecracker hypervisor > https://github.com/firecracker-microvm/firecracker. > > To check schema and syntax errors, the bindings file is verified with: > ``` > make dt_binding_check \ > DT_SCHEMA_FILES=\ > Documentation/devicetree/bindings/rng/microsoft,vmgenid.yaml > ``` > and the patches were verified with: > `scripts/checkpatch.pl --strict v4-000*`. > > Changelog with respect to version 3: > - Changed the compatible string from "virtual,vmgenctr" to > "microsoft,vmgenid" as per review comments. > - Renamed vmgenid.yaml to follow DT file naming convention. > - Updated the description of properties and example in vmgenid yaml file. > - Addressed the review comments to remove all ifdefs in vmgenid.c with one > exception which still needs to be under CONFIG_ACPI. > - reformated the code with clang-format. > - Tested code with W=1, Sparse, Smatch and Coccinelle tools. > > Changelog with respect to version 2: > - As per review comments, used platform apis instead of "of_*" APIs, > removed unnecessary #include and used IF_ENABLED instead of ifdef. > - Added more info for vmgenid buffer address and corrected the formatting. > - Replaced the compatible string from "linux,*" to "virtual,*" because, > the device does not have a vendor. > > Changelog with respect to version 1: > - Moved vmgenid.yaml bindings to the more related "rng" folder. > - Removed `vmgenid_remove` to since it is unrelated to the > current goal of the patch. > - Updated the cover letter and bindings commit > "[PATCH v2 3/4] dt-bindings: rng: Add vmgenid support" to > provide more information on vmgenid. > - Compiled with and without CONFIG_OF/CONFIG_ACPI and fixed > compilers errors/warnings. > > > Sudan Landge (5): > virt: vmgenid: rearrange code to make review easier > virt: vmgenid: change implementation to use a platform driver > virt: vmgenid: enable driver regardless of ACPI config > dt-bindings: rng: Add vmgenid support > virt: vmgenid: add support for devicetree bindings > > .../bindings/rng/microsoft,vmgenid.yaml | 49 +++++ > MAINTAINERS | 1 + > drivers/virt/Kconfig | 1 - > drivers/virt/vmgenid.c | 168 ++++++++++++++---- > 4 files changed, 180 insertions(+), 39 deletions(-) > create mode 100644 Documentation/devicetree/bindings/rng/microsoft,vmgenid.yaml > > > base-commit: 20cb38a7af88dc40095da7c2c9094da3873fea23 Due to a mail server error the last patch of this series, "Re: [PATCH v4 5/5] virt: vmgenid: add support for devicetree bindings", got sent separately. Apologies for this. I will resend the patches to correct this issue so, I request reviewers to please ignore this patch.