From nobody Mon Feb 9 07:22:10 2026 Received: from smtp-fw-80007.amazon.com (smtp-fw-80007.amazon.com [99.78.197.218]) (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 C4638405FD; Mon, 25 Mar 2024 19:53:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=99.78.197.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711396417; cv=none; b=n0ORiSCUSkbVnwqn8X5kPWMjObVNSkD+RZlh/u3WkFo1M+SBWSQ3slXq3Mkt4sDoV4VhWvh1LdHSBKUBN4hIg0Yvv9+62SIrmOreAkApcJ2c/XIpKcpJPDonxZCz6lo1IBm6aS6FigYhnDPeLNpaRmP5C8xzgCJN76uW5nCJGzQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711396417; c=relaxed/simple; bh=V5QfoxDhwAJ0q0BlEtFIGB+N4NV5UoeStGXWV9Li+qA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=DXVmjlUw9Bm+lDhx/p7VgEAah3QxVDQjciKpePfAD3ruDMH1NLMN88KDIYz1ISRG1gtZ1AduC8PnveAxAv9BC/h7o45RYcovb+5bkDiydvRhixFRgHMz4PAZ0pmot4/qL2KtS+vasVYFwaiCNqrpKq7fansaZSw7P6fjpoHUv6w= 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=s+4UPc5f; arc=none smtp.client-ip=99.78.197.218 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="s+4UPc5f" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1711396416; x=1742932416; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=780CzWQuS3gw5Y/2WbB9iB+XzN5JGzKplO7LP7fR96Q=; b=s+4UPc5fVVmsKB1bBMiBcY4jzSozHjbY5XAuoDidTmE2gu87v18BaHVM 0wl3gmYrrRo7RXpFjXxOmvUEGPRjYj/QWa9UyRlY5pddZGfL0VI4EEYUx /JUc+mJUTW7szVyTTGw8fuHUidSaOIvzc68ZDBZmgxOs0lAv1PqAq+qm3 Q=; X-IronPort-AV: E=Sophos;i="6.07,154,1708387200"; d="scan'208";a="283714625" Received: from pdx4-co-svc-p1-lb2-vlan2.amazon.com (HELO smtpout.prod.us-east-1.prod.farcaster.email.amazon.dev) ([10.25.36.210]) by smtp-border-fw-80007.pdx80.corp.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Mar 2024 19:53:31 +0000 Received: from EX19MTAEUA001.ant.amazon.com [10.0.43.254:16692] by smtpin.naws.eu-west-1.prod.farcaster.email.amazon.dev [10.0.24.234:2525] with esmtp (Farcaster) id 633946d4-ff55-4761-967e-78cd922af786; Mon, 25 Mar 2024 19:53:30 +0000 (UTC) X-Farcaster-Flow-ID: 633946d4-ff55-4761-967e-78cd922af786 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; Mon, 25 Mar 2024 19:53:30 +0000 Received: from bcd074994f7f.amazon.com (10.106.83.11) 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; Mon, 25 Mar 2024 19:53:25 +0000 From: Sudan Landge To: , , , , , , , , , , CC: , , , Subject: [PATCH v3 1/4] virt: vmgenid: rearrange code to make review easier Date: Mon, 25 Mar 2024 19:53:03 +0000 Message-ID: <20240325195306.13133-2-sudanl@amazon.com> X-Mailer: git-send-email 2.39.3 (Apple Git-146) In-Reply-To: <20240325195306.13133-1-sudanl@amazon.com> References: <20240325195306.13133-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: quoted-printable X-ClientProxiedBy: EX19D039UWB001.ant.amazon.com (10.13.138.119) To EX19D036EUC002.ant.amazon.com (10.252.61.191) Content-Type: text/plain; charset="utf-8" Rearrage the functions of vmgenid to make the next commit, which re-implements vmgenid as a platform driver, easier to review. Signed-off-by: Sudan Landge --- drivers/virt/vmgenid.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/virt/vmgenid.c b/drivers/virt/vmgenid.c index b67a28da4702..ea956df02874 100644 --- a/drivers/virt/vmgenid.c +++ b/drivers/virt/vmgenid.c @@ -21,6 +21,20 @@ struct vmgenid_state { u8 this_id[VMGENID_SIZE]; }; =20 +static void vmgenid_notify(struct acpi_device *device, u32 event) +{ + struct vmgenid_state *state =3D acpi_driver_data(device); + char *envp[] =3D { "NEW_VMGENID=3D1", NULL }; + u8 old_id[VMGENID_SIZE]; + + memcpy(old_id, state->this_id, sizeof(old_id)); + memcpy(state->this_id, state->next_id, sizeof(state->this_id)); + if (!memcmp(old_id, state->this_id, sizeof(old_id))) + return; + add_vmfork_randomness(state->this_id, sizeof(state->this_id)); + kobject_uevent_env(&device->dev.kobj, KOBJ_CHANGE, envp); +} + static int vmgenid_add(struct acpi_device *device) { struct acpi_buffer parsed =3D { ACPI_ALLOCATE_BUFFER }; @@ -65,20 +79,6 @@ static int vmgenid_add(struct acpi_device *device) return ret; } =20 -static void vmgenid_notify(struct acpi_device *device, u32 event) -{ - struct vmgenid_state *state =3D acpi_driver_data(device); - char *envp[] =3D { "NEW_VMGENID=3D1", NULL }; - u8 old_id[VMGENID_SIZE]; - - memcpy(old_id, state->this_id, sizeof(old_id)); - memcpy(state->this_id, state->next_id, sizeof(state->this_id)); - if (!memcmp(old_id, state->this_id, sizeof(old_id))) - return; - add_vmfork_randomness(state->this_id, sizeof(state->this_id)); - kobject_uevent_env(&device->dev.kobj, KOBJ_CHANGE, envp); -} - static const struct acpi_device_id vmgenid_ids[] =3D { { "VMGENCTR", 0 }, { "VM_GEN_COUNTER", 0 }, --=20 2.40.1