Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp200694lqp; Wed, 20 Mar 2024 19:52:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWL79pj60gbhKoc6kAPTkChFQreuMY7uk2ldFy9ii86wObmzAINq4IhICUk2XXPL3bJUIjZhx0xwLuve0A9u7FAVTMfBgamVprbEugymA== X-Google-Smtp-Source: AGHT+IFrmLCSUEFI/vlwUsJct2NxWOQm7/KZH9rY+Ahqz0f+A/JSpnTHWRxv8h9V9XVyuiwF7FzM X-Received: by 2002:a0d:ea51:0:b0:60c:d785:21ee with SMTP id t78-20020a0dea51000000b0060cd78521eemr4269971ywe.18.1710989536987; Wed, 20 Mar 2024 19:52:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710989536; cv=pass; d=google.com; s=arc-20160816; b=noYArraCLj9BFFWtJDz8b+aXSh5c0a/S8rCGtRj7D46ag72ct2SaLrfJ+YdXTbJkb9 tp36htAjUpqSXtFopBMaB5I4Hd8in4nlvuV2TJz7Xtk97MkvPQX4wAz2VJKHFmby8u1e Z/Q4K9CooOejSoBTZ4AF2r8E9ybLcEr1ZZUGZYm8lWYwAywkNJ8yBl0Klb0zam+62dvj ZZq4YWNJziOIdCWrPU5D9Cir36sGz53wNjjaoWVpQptLQvK6OtYA+2/oejO78M6CwNoE 8sz2Br/TdQmU/CuSgTR704tQrUSnfCxqDtkrYiOLO1jwDPVxoTlxYw8e4v+QBFPajnzZ s0LQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=G5dhZaRQlfB7f7CNYBWHN5QscrDy9JTquI8zOhrJCpk=; fh=eulCrYuY4zK7Gxr6B+4yAHyThWGi9/x0Te9WMho9aNk=; b=nWBx/l0xueDjqR99iA9J+jXid0Yfq9KxT5zensB/ClLsgz6p1Ufk8EtPaUeFYADzkW K/zZFBNOu5GGtU01qGXt/J7Y536Ix7Y16kRYHSwsp8Ca9o9pfqcrd5KFvnxQTLk53yAJ I2crCXfTGWaLXfnHeG/XopcL8yMrzbP8u76UEK9lMMHPVl2QrqNHB+sLOk5ZZ7cjmUbj 1WE6RswOvJxgwX+tyEVl0vcq0AL4Iu7HPPuNu8nrvHwMTwoHYrmfQcoHRF0aSMQgyJjQ O92d2pgF8npI6ZziTcTSwxvz4qKfTWoBRVP9Nse3xBbOqbaHuRxWn+zqe6qCQqf/nuw7 hsVg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b="ajILYF2/"; arc=pass (i=1 spf=pass spfdomain=amazon.co.uk dkim=pass dkdomain=amazon.com dmarc=pass fromdomain=amazon.com); spf=pass (google.com: domain of linux-kernel+bounces-109604-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109604-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6-20020ac85746000000b0042ef6173d39si14635585qtx.350.2024.03.20.19.52.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 19:52:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-109604-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b="ajILYF2/"; arc=pass (i=1 spf=pass spfdomain=amazon.co.uk dkim=pass dkdomain=amazon.com dmarc=pass fromdomain=amazon.com); spf=pass (google.com: domain of linux-kernel+bounces-109604-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109604-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com 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 A50121C20349 for ; Thu, 21 Mar 2024 02:52:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A3F6679D8; Thu, 21 Mar 2024 02:51:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="ajILYF2/" Received: from smtp-fw-6002.amazon.com (smtp-fw-6002.amazon.com [52.95.49.90]) (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 C46FDBE4A; Thu, 21 Mar 2024 02:51:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=52.95.49.90 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710989495; cv=none; b=NG6HzJ5t0NTEjE7UARU19JL1wa1ZIKOR0kvys9pIWTyGm/0gBlG5+DwMLy5vPRbdtpjXdvivoc5TZAZOjFnHo1N6z2QF2b1N3qd21UbXmKAjxUqxNN8rWmtOTC3bCzS/g/PieTTBhixeeRm3kjQkUj9Us0vgaTcN1fDoCOJe6nQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710989495; c=relaxed/simple; bh=i4WFnTjbboOv3N6BjZB4Dczpvy+GhVVvEUDiM6kzroU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Fr6eYIDCJ0kYeQDkgFg9Ul+aBeiYuiM9lpjwFC6NbxJE5Lf1DOiZVkRSJvyfhCB/1b/OvG8SevBnXyqUmQNH/Xa7cABAl5rp/rbUEUYvEJ3hZy1bU3Qi5o65QxSqCYk20GEshN+SR7Ut/XsEdZ5c1Ti8vo8gJQGKwNY/lkaeiTk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com; spf=pass smtp.mailfrom=amazon.co.uk; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b=ajILYF2/; arc=none smtp.client-ip=52.95.49.90 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com 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.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1710989494; x=1742525494; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=G5dhZaRQlfB7f7CNYBWHN5QscrDy9JTquI8zOhrJCpk=; b=ajILYF2/e62girKfI9IR7p8CYMBfC5O1vvbPosxeorD+l0dN+4N2HFGs EXqS5XEBlByxsTjwGCmGfBIs8XVADidEvmTdjM7yZIcLtrzs3Pa+qphk+ 1p6j81rmhagwftGgFoNGn743fgYLZlq8PEphnqAFrdIS+7MN4mkNZFuEG 4=; X-IronPort-AV: E=Sophos;i="6.07,141,1708387200"; d="scan'208";a="394817793" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO smtpout.prod.us-east-1.prod.farcaster.email.amazon.dev) ([10.43.8.6]) by smtp-border-fw-6002.iad6.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2024 02:51:33 +0000 Received: from EX19MTAEUC002.ant.amazon.com [10.0.17.79:25006] by smtpin.naws.eu-west-1.prod.farcaster.email.amazon.dev [10.0.23.112:2525] with esmtp (Farcaster) id 02fcd6f8-c622-4150-946e-5f418e1db5de; Thu, 21 Mar 2024 02:51:32 +0000 (UTC) X-Farcaster-Flow-ID: 02fcd6f8-c622-4150-946e-5f418e1db5de Received: from EX19D036EUC002.ant.amazon.com (10.252.61.191) by EX19MTAEUC002.ant.amazon.com (10.252.51.245) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.28; Thu, 21 Mar 2024 02:51:31 +0000 Received: from bcd074994f7f.amazon.com (10.106.82.23) 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; Thu, 21 Mar 2024 02:51:27 +0000 From: Sudan Landge To: , , , , , , , , , , CC: , , , Subject: [PATCH v2 3/4] dt-bindings: rng: Add vmgenid support Date: Thu, 21 Mar 2024 02:51:04 +0000 Message-ID: <20240321025105.53210-4-sudanl@amazon.com> X-Mailer: git-send-email 2.39.3 (Apple Git-146) In-Reply-To: <20240321025105.53210-1-sudanl@amazon.com> References: <20240321025105.53210-1-sudanl@amazon.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: EX19D043UWA002.ant.amazon.com (10.13.139.53) To EX19D036EUC002.ant.amazon.com (10.252.61.191) Virtual Machine Generation ID driver 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. As per the specs, hypervisor should provide a globally unique identified, or GUID via ACPI. This patch tries to mimic the mechanism to provide the same functionality which is for a hypervisor/BIOS to notify the virtual machine when it is executed with a different configuration. As part of this support the devicetree bindings requires the hypervisors or BIOS to provide a memory address which holds the GUID and an IRQ which is used to notify when there is a change in the GUID. The memory exposed in the DT should follow the rules defined in the vmgenid spec mentioned above. *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 chose DT over ACPI, we would like to highlight that the hypervisors that have chose 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. The point of vmgenid is to provide a mechanism to discover a GUID when the execution state of a virtual machine changes and the simplest way to do it is pass a memory location and an interrupt via devicetree. It would complicate things unnecessarily if instead of using devicetree, we try to implement a new protocol or modify other protocols to somehow provide the same functionility. We believe that adding a devicetree binding for vmgenid is a simpler, better alternative to provide the same functionality and will allow such hypervisors as mentioned above to continue using devicetree. 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 Signed-off-by: Sudan Landge --- .../devicetree/bindings/rng/vmgenid.yaml | 57 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 58 insertions(+) create mode 100644 Documentation/devicetree/bindings/rng/vmgenid.yaml diff --git a/Documentation/devicetree/bindings/rng/vmgenid.yaml b/Documentation/devicetree/bindings/rng/vmgenid.yaml new file mode 100644 index 000000000000..4b6ab62cc2ae --- /dev/null +++ b/Documentation/devicetree/bindings/rng/vmgenid.yaml @@ -0,0 +1,57 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/rng/vmgenid.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Virtual Machine Generation Counter ID device + +maintainers: + - Jason A. Donenfeld + +description: + Firmwares or hypervisors can use this devicetree to describe + interrupts and the shared resources to inject a Virtual Machine Generation + counter. + +properties: + compatible: + const: linux,vmgenctr + + "#interrupt-cells": + const: 3 + description: | + The 1st cell is the interrupt type. + The 2nd cell contains the interrupt number for the interrupt type. + The 3rd cell is for trigger type and level flags. + + interrupt-controller: true + + reg: + description: | + specifies the base physical address and + size of the regions in memory which holds the VMGenID counter. + maxItems: 1 + + interrupts: + description: | + interrupt used to notify that a new VMGenID counter is available. + The interrupt should be Edge triggered. + maxItems: 1 + +required: + - compatible + - reg + - interrupts + +additionalProperties: false + +examples: + - | + rng@80000000 { + compatible = "linux,vmgenctr"; + reg = <0x80000000 0x1000>; + interrupts = <0x00 0x23 0x01>; + }; + +... diff --git a/MAINTAINERS b/MAINTAINERS index 43b39956694a..cf4b2e10fb49 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -18431,6 +18431,7 @@ M: "Theodore Ts'o" M: Jason A. Donenfeld S: Maintained T: git https://git.kernel.org/pub/scm/linux/kernel/git/crng/random.git +F: Documentation/devicetree/bindings/rng/vmgenid.yaml F: drivers/char/random.c F: drivers/virt/vmgenid.c -- 2.40.1