From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CA106C6FA82 for ; Fri, 23 Sep 2022 10:30:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ab6dhvSp/1vFfy2r0VDcBqmYqqyNhgLTEUKGe1Cepw4=; b=Vvbw73+mBdOpfc TQEh4i0cXSNzFz9n6Xrw70K8rchk2OUzE3Qw+O4Gy5OuyqNxb1HQAomuqhzVcwjGD12Z+KXrbGzek NIN06hbt2Gq8MBENffye/b9hdCkqHo/mBsL4/IDAHYHBh4bfRI1rzuSorAwVjqktPQGgClOQicG7v iFRJCkahZTpF9o5tJlLk3tE/XytP4SPwgaqbtvdVFtonFVAnZsOhPGC38VTUuhBzGiBV9ijYacdnH FHID6tBN1PkI+Bf7K331nDlL3dBlx7vnZ0pWpJQSN2I323KOXh5bMnov+h3NNWhHZCc9Sl30acTnt nbUxBJq5WU3jowb0QL2w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1obfvJ-003dt1-SS; Fri, 23 Sep 2022 10:28:45 +0000 Received: from mail-wr1-f51.google.com ([209.85.221.51]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1obfvG-003drr-T6 for linux-arm-kernel@lists.infradead.org; Fri, 23 Sep 2022 10:28:44 +0000 Received: by mail-wr1-f51.google.com with SMTP id z6so19792950wrq.1 for ; Fri, 23 Sep 2022 03:28:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=OCZ/F0HrnTTtm97NDW9M9Tgyn70w4D8p3nQznpQwDv8=; b=dKPpGlaDQfir5FygrB0pp+JKdDTwil9PFH8r5X1QnwoZ1DPOeICE45vqez+/DZQSXY gdp8R/lQUiJEEyoqu3sHwsunckGpzzFKS/+jWGoJbTGNP3z79Kjosnd/BkExRR0GaUr8 3CFw601svTiOP7Ayd8d2sZIRvawTLaFWP0gEE5nqbO08rRIiuZ+JW/CRorokpZyAt5om MNtB1FU/tBY/ztR5L7R2v5Xn4/y85M2WB+5nLy++CmthlqYuxJDWJsKObxqSOcLHLd8b r02TDxiokbuN6aXa9vlnfoX4nXei9blbXdrdg5RBr/JQARFuDHVxmujeokJUjVQgm5fF K1xg== X-Gm-Message-State: ACrzQf3Z9eyyG/Y9ScATj17qph2KhkQ0cjzkcHAT3SSVIKZQ1IVsKtk6 GRavqYjgPbZxKWii1n1NAYg= X-Google-Smtp-Source: AMsMyM6ReHmiL0VAv9tsouVLQLi1H9NIY57WE7jvQxO0L+Gqhf49wPXtahs+x4ZQsAC7C8GqzibFfw== X-Received: by 2002:a5d:64e5:0:b0:22a:3cae:93bf with SMTP id g5-20020a5d64e5000000b0022a3cae93bfmr4833236wri.323.1663928918727; Fri, 23 Sep 2022 03:28:38 -0700 (PDT) Received: from liuwe-devbox-debian-v2 ([51.145.34.42]) by smtp.gmail.com with ESMTPSA id x12-20020adfffcc000000b0022ac672654dsm6976948wrs.58.2022.09.23.03.28.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Sep 2022 03:28:38 -0700 (PDT) Date: Fri, 23 Sep 2022 10:28:36 +0000 From: Wei Liu To: Li kunyu Cc: kys@microsoft.com, haiyangz@microsoft.com, sthemmin@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, catalin.marinas@arm.com, will@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, arnd@arndb.de, linux-hyperv@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Subject: Re: [PATCH v2] asm-generic: Remove the parameters of the generate_guest_id function and modify the return type and modify the function name Message-ID: References: <20220920032837.69469-1-kunyu@nfschina.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220920032837.69469-1-kunyu@nfschina.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220923_032842_962294_A0F222B5 X-CRM114-Status: GOOD ( 29.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Kunyu The subject line is far too long. Please change it to hyperv: simplify and rename generate_guest_id On Tue, Sep 20, 2022 at 11:28:37AM +0800, Li kunyu wrote: > The generate_guest_id function is more suitable for use after the > following modifications. > 1. Modify the type of the guest_id variable to u64, which is compatible > with the caller. > 2. Remove all parameters from the function, and write the parameter > (LINUX_VERSION_CODE) passed in by the actual call into the function > implementation. > 3. Rename the function to make it clearly a Hyper-V related function, > and modify it to hv_generate_guest_id. > > v2: > Fix generate_guest_id to hv_generate_guest_id. The patch version information shouldn't be part of the commit message. You can use scissors to separate them ---8<--- v2: ... When the patch gets applied, text after the scissors will be stripped automatically. > > Signed-off-by: Li kunyu BTW, the previous patch was submitted by Li Zeming. Did you two agree on who to take this forward? > --- > arch/arm64/hyperv/mshyperv.c | 2 +- > arch/x86/hyperv/hv_init.c | 2 +- > include/asm-generic/mshyperv.h | 12 +++++------- > 3 files changed, 7 insertions(+), 9 deletions(-) > > diff --git a/arch/arm64/hyperv/mshyperv.c b/arch/arm64/hyperv/mshyperv.c > index bbbe351e9045..3863fd226e0e 100644 > --- a/arch/arm64/hyperv/mshyperv.c > +++ b/arch/arm64/hyperv/mshyperv.c > @@ -38,7 +38,7 @@ static int __init hyperv_init(void) > return 0; > > /* Setup the guest ID */ > - guest_id = generate_guest_id(0, LINUX_VERSION_CODE, 0); > + guest_id = hv_generate_guest_id(); > hv_set_vpreg(HV_REGISTER_GUEST_OSID, guest_id); > > /* Get the features and hints from Hyper-V */ > diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c > index 3de6d8b53367..93770791b858 100644 > --- a/arch/x86/hyperv/hv_init.c > +++ b/arch/x86/hyperv/hv_init.c > @@ -426,7 +426,7 @@ void __init hyperv_init(void) > * 1. Register the guest ID > * 2. Enable the hypercall and register the hypercall page > */ > - guest_id = generate_guest_id(0, LINUX_VERSION_CODE, 0); > + guest_id = hv_generate_guest_id(); > wrmsrl(HV_X64_MSR_GUEST_OS_ID, guest_id); > > /* Hyper-V requires to write guest os id via ghcb in SNP IVM. */ > diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h > index c05d2ce9b6cd..7f4a23cee56f 100644 > --- a/include/asm-generic/mshyperv.h > +++ b/include/asm-generic/mshyperv.h > @@ -25,6 +25,7 @@ > #include > #include > #include > +#include > > struct ms_hyperv_info { > u32 features; > @@ -105,15 +106,12 @@ static inline u64 hv_do_rep_hypercall(u16 code, u16 rep_count, u16 varhead_size, > } > > /* Generate the guest OS identifier as described in the Hyper-V TLFS */ > -static inline __u64 generate_guest_id(__u64 d_info1, __u64 kernel_version, > - __u64 d_info2) > +static inline u64 hv_generate_guest_id(void) ^^ There are two spaces. We only need one. I know it is not introduced by you, but since you're modifying the code anyway, you may as well drop the extraneous space. > { > - __u64 guest_id = 0; > + u64 guest_id; > > - guest_id = (((__u64)HV_LINUX_VENDOR_ID) << 48); > - guest_id |= (d_info1 << 48); > - guest_id |= (kernel_version << 16); > - guest_id |= d_info2; > + guest_id = (((u64)HV_LINUX_VENDOR_ID) << 48); > + guest_id |= (((u64)LINUX_VERSION_CODE) << 16); > > return guest_id; > } > -- > 2.18.2 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel