Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2913439lqp; Mon, 25 Mar 2024 12:53:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVzek7g3ejN+WFC+wySklb014z/MZEXnCxlY5FIEVf532XmD1IQluEaxG88ZnKg3Cwbe3CQWtAXQAK7aJXuOANNGbpVNKUimp3PBMQ6oQ== X-Google-Smtp-Source: AGHT+IF4zNBx7337whrLeDcT+Cn6DEC5G3HxhJQ/RqC96pAudB6UDcIVua8P20XOcNyvTwqX8fXC X-Received: by 2002:a0d:c9c5:0:b0:610:e1f5:64d with SMTP id l188-20020a0dc9c5000000b00610e1f5064dmr6243399ywd.23.1711396432833; Mon, 25 Mar 2024 12:53:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711396432; cv=pass; d=google.com; s=arc-20160816; b=IORrY8U/SDk9hT32cq7/QU2LHdh69jWZ7ExwgNXKZ2tBP3Woy/TSaQQiSHvgGk1mek KqrH2jTdpqoSmpp0Dl+gfQ4OCd+TAzRYdDbYu+J4MfcLRS2VEIpN52HKWK0ZSMVdrGvA CwFeYRZSS4QfXgsBj28yIYm0kueGKWKsEDXDRwqL4sGJNYoUZZDC8eFEtLxJDqKpDv2H zUgJISAuLMvzixZo57P8pLnEs2swGn5vdfR7Tc5XGHhh5JW4AlRwMtmXtzI8pRGix0GC AYHKJcvoj2K8aNsRAk6zSfe96twYSrslqMWxBetTRhCiN475Rqr4PhSUjxuoxPYtcqaS ho+g== 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=780CzWQuS3gw5Y/2WbB9iB+XzN5JGzKplO7LP7fR96Q=; fh=eulCrYuY4zK7Gxr6B+4yAHyThWGi9/x0Te9WMho9aNk=; b=uzxCZmAo+MRH08q2Lx3KH9hxVw6duqWpADkzfHENRbC2bR0sF4HUMbrLVTbHjz8w0n XKgsmT2Jnt0Km5D68i00nFeJYRX9YxIsbsHTrtBChWIgJyVa8pUe3deHpxgBYTCV3Xa+ Wu1yt98YPW59LMGoNhWT914OZ6nH6mew7FMBKOb1q7a2lIz+fkSlb+tGp/bNJOciTXbe OYhJF+q4DM4QY9peH5UqhVeKKPtpTzIyQ9+Qw4HAyrHfY8NirqocoL8NlxkRwqadsU7Z LoCl0nQFa8neat5qK9PXLG6rjALPHhgDNCEw6n0FW0IA0MLhlxe0BMlb7IIcIf9HNL8N hNvA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=s+4UPc5f; 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-117855-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117855-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 n7-20020ae9c307000000b00789e981c0cfsi6116688qkg.120.2024.03.25.12.53.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 12:53:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-117855-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=s+4UPc5f; 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-117855-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117855-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 745F01C60875 for ; Mon, 25 Mar 2024 19:53:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 39C4429CE7; Mon, 25 Mar 2024 19:53:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="s+4UPc5f" 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 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: 8bit Content-Type: text/plain X-ClientProxiedBy: EX19D039UWB001.ant.amazon.com (10.13.138.119) To EX19D036EUC002.ant.amazon.com (10.252.61.191) 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]; }; +static void vmgenid_notify(struct acpi_device *device, u32 event) +{ + struct vmgenid_state *state = acpi_driver_data(device); + char *envp[] = { "NEW_VMGENID=1", 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 = { ACPI_ALLOCATE_BUFFER }; @@ -65,20 +79,6 @@ static int vmgenid_add(struct acpi_device *device) return ret; } -static void vmgenid_notify(struct acpi_device *device, u32 event) -{ - struct vmgenid_state *state = acpi_driver_data(device); - char *envp[] = { "NEW_VMGENID=1", 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[] = { { "VMGENCTR", 0 }, { "VM_GEN_COUNTER", 0 }, -- 2.40.1