Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp200593lqp; Wed, 20 Mar 2024 19:51:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU5NjGrF1hyVfGxOd2Y+Jsp2LbZjuyFBjjeHu4zokmnj4f1Uscq64rV6/B3XZm+dVe9sSqcL6/u0+2ZB3KBpwHQMC1gLm/XYgcDR4tcvg== X-Google-Smtp-Source: AGHT+IHT7js8MnTRu9uDdZSqiYaVdDVebVlVuAqLqLI0IQsMBWw7jSgBqkrLtb0jCr1U03L7TSM0 X-Received: by 2002:a05:6830:a42:b0:6e5:1aca:aa26 with SMTP id g2-20020a0568300a4200b006e51acaaa26mr863620otu.7.1710989516948; Wed, 20 Mar 2024 19:51:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710989516; cv=pass; d=google.com; s=arc-20160816; b=swBBlDxnjTmiYxi4q0FcRWAW8WybHWvO12PpU2ExroVS3d18nxZRGv0e0m/iItdo2K YfAH7OEMJdWf7Q+cV0GsNLEiNJDFkC02EbTInrhwgfaKE/cY5zhWoahSIKAjtuUGG7eW FrDAxq29/Rl6IZifagCjZMisSDR1tXVMnMV3I8iYxlIubI8mqyinQ9EMGCIdUW3hUfEI 6aeq+Q97K0+vfgaFyTbHhUWqbzPkLqYJWS5MsOBcdVHdU+JcFvoC5I1gL/vj7BhGVeKq BR2SsQvFmGwbKavxz/Llk33KWV8XJJfdM/s+lfxHAG2MYZbgJo0hFmTyaf5YFxEBdcLY 9Ayw== 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=cp3yRdRsevzRFA7gwFFQLgiJI77A3nzpG5Q3xbviH47t3Y3LkHNojCNCVCTqlJTwoq fyl7aDKCbR7YgmTjk0kE8YQ826UM3JBK6iTG6HGSUba9sqVeb4lmW/yAbCyqZ4j2re3P hvm85iJAHGj9+4D2qPs6U95SDbY94lcTJz92TZkHIxcRhVa17nAulGGTJgwm67Re2ELZ Dc9ODgmTGj5OmKrlXic3LUoA8eCGdBGmeVc4YaClKJSTyA4AJrZkdpEYmGjb9JaaUxN0 HAu0DkIOJV2G45ZQQBwJXGS5ZMKzm8LCsp8u5iB46xWPYaRN4tEObzQ4yWe3xQy09jBF ftJg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=eRxvE4r8; 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-109602-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109602-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id k134-20020a636f8c000000b005e858e6a1e5si3725203pgc.585.2024.03.20.19.51.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 19:51:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-109602-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=eRxvE4r8; 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-109602-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109602-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 7D5A8B22412 for ; Thu, 21 Mar 2024 02:51:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 49C64323C; Thu, 21 Mar 2024 02:51:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="eRxvE4r8" Received: from smtp-fw-2101.amazon.com (smtp-fw-2101.amazon.com [72.21.196.25]) (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 8785379D8; Thu, 21 Mar 2024 02:51:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=72.21.196.25 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710989488; cv=none; b=AENJh5aAlMk0nug5Lr0HJ9YLF8vHssDynoEn02dsYLPcZw9bL58ThguBptemv3QTKULx6Cftc/wnCPhWkux9cw/m8U9TNYgfGWjyWcfwL7BppK5nC2txR5EIL+12EWcLZgZkxHq/SID4/XqHYTcpcBPdk2s8Y1C8fuNl+emNxyI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710989488; c=relaxed/simple; bh=V5QfoxDhwAJ0q0BlEtFIGB+N4NV5UoeStGXWV9Li+qA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=C/ABRZs8NdzXORvkf2MkKS6mp/OCFm3ma5ytto6NLEoYh41rJ7UEjDZsWPMYt5x5pYh7t2K6mh3DkaoqITS3x8Rl76QCcPyR1bmE1HrIKib0iWHHDWbGuogt1s11gRjLw9kQAGr6NL30thRiGhx8R8KD/0oM7Et12zHGRk3TNnI= 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=eRxvE4r8; arc=none smtp.client-ip=72.21.196.25 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=1710989486; x=1742525486; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=780CzWQuS3gw5Y/2WbB9iB+XzN5JGzKplO7LP7fR96Q=; b=eRxvE4r8cucGZq5N1LT3pnOWbPai2R0UgXy5a/BnsZGNf51T0QwHFsae di8Kpvo84k2L6oqxiFcQkgZhoQOk+1dQQx6tYfeSn5WDR59rwYUfh/fF8 2KTnyabFke6KnetG25x9PeWO/S8C2RlyQLR/R7nT0CoMbOFdW07QX1A0x Q=; X-IronPort-AV: E=Sophos;i="6.07,141,1708387200"; d="scan'208";a="389303551" 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-2101.iad2.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2024 02:51:22 +0000 Received: from EX19MTAEUA002.ant.amazon.com [10.0.17.79:55052] by smtpin.naws.eu-west-1.prod.farcaster.email.amazon.dev [10.0.6.197:2525] with esmtp (Farcaster) id 5cc6084e-03c4-492e-875e-b4cc0c2a6394; Thu, 21 Mar 2024 02:51:22 +0000 (UTC) X-Farcaster-Flow-ID: 5cc6084e-03c4-492e-875e-b4cc0c2a6394 Received: from EX19D036EUC002.ant.amazon.com (10.252.61.191) by EX19MTAEUA002.ant.amazon.com (10.252.50.124) 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:21 +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:17 +0000 From: Sudan Landge To: , , , , , , , , , , CC: , , , Subject: [PATCH v2 1/4] virt: vmgenid: rearrange code to make review easier Date: Thu, 21 Mar 2024 02:51:02 +0000 Message-ID: <20240321025105.53210-2-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) 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