Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp913253lqt; Tue, 19 Mar 2024 07:34:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWXmiQGG10n7YQNH8iFZWdWGIGMJhrdalPWszuC52YAv/c729CPlfJQ9gCVzLWn9YzElT9YHHc7pMFxrOj6sTKzFxnwc3lCFtMIANzIrw== X-Google-Smtp-Source: AGHT+IGIYQ43bUfEwZUqBlNMa1F6FkwRw2F2LZjedlZ4rH75KFnOO9+IFGj5N9Nuz7DgJiY3h29C X-Received: by 2002:a05:6359:6102:b0:17e:bae0:fe8b with SMTP id rz2-20020a056359610200b0017ebae0fe8bmr11664569rwb.15.1710858839892; Tue, 19 Mar 2024 07:33:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710858839; cv=pass; d=google.com; s=arc-20160816; b=ryawKO038TJ25ZOcp4efDjV8AVJqbm+935CIHP5rFP1dD6RLo9u+NbWSI2R7bdnMqI GBkT4w+bWdjkznbV+wpIvLDJwKFzbJYLX+MKFjnNs7bCBrPv4srmYVlzVtBAWHOf2jhp p1DQhVX+PcwR3EAa0RaVzck7hTiusTU+NEusz+laDOvscp2UCr7Of6WoThyEG8pBfaR/ f6DuVsvASySZGHT2RNjEfFm6BVHMqhGqmGuFCeHUwABWdO21F5WPx2LTxIPVH7rp3MYa 3HzJG2t6twjnrC02mp3uK2J+KD8s2abmfanRaCPpoEBLoecS5gC2/RLe7TyTKnr0JJ4a nyvA== 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=vR0KMMGyyfo3FWYIp8N0cMZr5WrwzGeEBtULaAnaM5w4W7RIf0DmHRWbToCM03cZn1 6pBjsycO+Dlwfcc273caIaqzYDsB65aOBJy15Gpye9U0SVc7Tj4d0Zhu4Z4higHxGmjC dcGE0XT/1k0ohQblWTJavFELqrk4Ooj269CCGU7Vz/3a+6WwynEYbQ0BX3jiT3xoV6y2 urX4HhJsnUkMWDTaHLA8ttRb1ynA9dEoltwDIpwQzbVTfYT4b2heDNdszOf+HyH1qo+/ W5jiANeFpNtk2p53vPj6weJUMzFyQI4ZvhfIwrBqewOkw7jbfqMErAyhgO/bczmRdi6L pWmQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=NhsvhxX1; 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-107653-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107653-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id q124-20020a632a82000000b005e49f54a865si9983225pgq.29.2024.03.19.07.33.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 07:33:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-107653-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=NhsvhxX1; 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-107653-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107653-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id B7FFD28502A for ; Tue, 19 Mar 2024 14:33:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 013E418029; Tue, 19 Mar 2024 14:33:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="NhsvhxX1" Received: from smtp-fw-9102.amazon.com (smtp-fw-9102.amazon.com [207.171.184.29]) (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 A482453385; Tue, 19 Mar 2024 14:33:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=207.171.184.29 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710858802; cv=none; b=fJJJtdfTtySxfZ7QH59y+cgBBcDXCdJG9ZglxoA1hyAurpzXeQODslbIzUNIUca9FgfyM7+KXMRnnMULW3gRfgg32QpnInZ9TQ7zajuMSfhh4tpZFOWkhoJR8AA/PVwoPCC6FUN6W8AOsBoy3a9BK0mRJ2Aty+7cNmFWiCYpIAQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710858802; c=relaxed/simple; bh=V5QfoxDhwAJ0q0BlEtFIGB+N4NV5UoeStGXWV9Li+qA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lMvEuHWUlpJgYjU8CphrevEIq+22X4iU+QEVxgIGAG0cO+wC1XKmrnOJrlOPo28K8+ZIOXf7jZiYL0r2DxO4rOzwFESL9loHPPowGV/zYx1nHun7Op3nGlBm+BvU54hhiGhBkAapjDfFMiJZy2gmy6q2C0g33gQIzbFKAkCrWwQ= 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=NhsvhxX1; arc=none smtp.client-ip=207.171.184.29 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=1710858800; x=1742394800; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=780CzWQuS3gw5Y/2WbB9iB+XzN5JGzKplO7LP7fR96Q=; b=NhsvhxX1ghq2Y+CdQFx9rtGOCmftUd7VDYjAn1sxsycg0lkgST5F1aEz 5G3YgnbuxRlHjOX2YGTTOgx3I52iyfLvjgnW0Vhd7KZAzu8GizfohNLxx 1nFFBafAiCvBaeNIiFZaUKD/srTOD/qH22N7Pe+LVHw3cTp0vwsMgPWvS E=; X-IronPort-AV: E=Sophos;i="6.07,137,1708387200"; d="scan'208";a="405001162" Received: from pdx4-co-svc-p1-lb2-vlan3.amazon.com (HELO smtpout.prod.us-east-1.prod.farcaster.email.amazon.dev) ([10.25.36.214]) by smtp-border-fw-9102.sea19.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Mar 2024 14:33:15 +0000 Received: from EX19MTAEUB002.ant.amazon.com [10.0.17.79:12055] by smtpin.naws.eu-west-1.prod.farcaster.email.amazon.dev [10.0.5.106:2525] with esmtp (Farcaster) id daf94e99-709a-44a0-8ce6-892fd80da2ee; Tue, 19 Mar 2024 14:33:13 +0000 (UTC) X-Farcaster-Flow-ID: daf94e99-709a-44a0-8ce6-892fd80da2ee Received: from EX19D036EUC002.ant.amazon.com (10.252.61.191) by EX19MTAEUB002.ant.amazon.com (10.252.51.59) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.28; Tue, 19 Mar 2024 14:33:13 +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; Tue, 19 Mar 2024 14:33:08 +0000 From: Sudan Landge To: , , , , , , , , , , CC: , , , Subject: [PATCH v1 1/4] virt: vmgenid: rearrange code to make review easier Date: Tue, 19 Mar 2024 14:32:50 +0000 Message-ID: <20240319143253.22317-2-sudanl@amazon.com> X-Mailer: git-send-email 2.39.3 (Apple Git-146) In-Reply-To: <20240319143253.22317-1-sudanl@amazon.com> References: <20240319143253.22317-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: EX19D046UWA004.ant.amazon.com (10.13.139.76) 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