Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp941859rdb; Sun, 18 Feb 2024 21:07:49 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUQT7i6xjYZjAm0YZckQe9Gh+BTsO4Fcooyvbmr2uYBrkwq1wPFMLW9mfRP+/XfMHIBv32CpS9t/sEAizLk3slGe0Z0KUWh255PKtXGPg== X-Google-Smtp-Source: AGHT+IHXSqvtvwDvjfQENpxrvKsq4uTxivFmz0wRmeDfCuhc1QrBhpJCJh0HAx3xZxghWnDnR6+N X-Received: by 2002:a17:903:1cd:b0:1db:aa65:12b2 with SMTP id e13-20020a17090301cd00b001dbaa6512b2mr8091147plh.56.1708319268908; Sun, 18 Feb 2024 21:07:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708319268; cv=pass; d=google.com; s=arc-20160816; b=dykYEuM8XSowZ71dU/IkXzykMbrOLGnAvlZuP6BUdqE65znUWA2dIlr3kJ1K4A0Yrd rk7aP6pPG7HLRwkD5e6TPu4S0pwo3+r/9MZUx0wihNRh3gW0bxx/xLQNYLmZWImjQOK2 Q/SaRL0OSuCVN8XVQ5908tuNYTtAzx/v89MQzgX3Q4Zg6pTjTV5On7XOQl2zb10HddzK 0kDiymeCWiWy9ieVKmxBHUU0KKsypLvmjgjwKB1xPmC1FvMT0wBZ1kKH04bOLA95SAAN 0IQxp971/yHrFjKxIWMKQdWe7eJ/V9wLnM+0I2osL7Lkn5bTGJMckhmKQ3qQW59NNptZ 8s3Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature :dkim-filter; bh=9ckmFXGd+kBfCNaMSlEmhj1yDgc8H+6mbo2mOcE5h70=; fh=PnCkZtS1R7zXby7F64RhwyR5nyZ3o+FY3Afjj3Bh/XM=; b=VbNL4ClYzNCdN3cExTFILzHhfO0SRZ/US5NAGvPYb0q+8xH5hfNVnOcjayH3RDtCLX JYqKV3mffor+35F21YvbuiQSmUmh6CjAjHj2kqBBmpdH5wtsFXVh883eQYzkJDKSmlKz ldF2B+T3VuwCtdw64TdTzvilREoJ6IgltB8WF0lCS1dtYzsPwNu9JP70cqomneFjY8Ui mV8SGR6ms4DQ1gGgEpCXwiy7NkmWzGsu2ins6gPCWfyXKkLqCtLguhR0bdC4AUdhsSky 9ekFep0ke6FRa1VTmndUFwDNkunwfvnnkxx/6V3Fg+lmgP9p4IupEHABjvE789C9mKZ5 fckg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=eX1QG6NB; arc=pass (i=1 spf=pass spfdomain=linux.microsoft.com dkim=pass dkdomain=linux.microsoft.com dmarc=pass fromdomain=linux.microsoft.com); spf=pass (google.com: domain of linux-kernel+bounces-70720-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70720-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id lm15-20020a170903298f00b001d73192de39si4113484plb.36.2024.02.18.21.07.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 21:07:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70720-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=@linux.microsoft.com header.s=default header.b=eX1QG6NB; arc=pass (i=1 spf=pass spfdomain=linux.microsoft.com dkim=pass dkdomain=linux.microsoft.com dmarc=pass fromdomain=linux.microsoft.com); spf=pass (google.com: domain of linux-kernel+bounces-70720-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70720-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.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 9ED69281958 for ; Mon, 19 Feb 2024 05:07:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 08CCF200B7; Mon, 19 Feb 2024 05:07:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="eX1QG6NB" Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C6592200A5; Mon, 19 Feb 2024 05:07:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708319263; cv=none; b=o0IcCwLrQke3jRic4SqT20X43j5wODJNu2ILyBQmJONkBBK90K78MbFKuHGkvfEFodosK7rfN70cIu03JGaxnxWj2hQ6+/rJHYo/2bSR3isLp/OPwsVg4yLc7fZkJGSFMmOFRhWoEVUzS91YKr2XVZ7ZrqlAqrsEE6mzO9DudT4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708319263; c=relaxed/simple; bh=w/57Q6ViACrAs5v87KnPuIhEM9z9CIbmcbv3D6hnStY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=avSqTg75syHrHEMlv01g1zzmhQQRRT8WLl00g4Sv93XlpJ52/JkpDzY1mscB46EsefMS0S0cB3ceNGxdQHHB6BnlHhFz+uwVM50/JS/2fDSab9nIehHow1avMa0wcyycn0fUsS8hn+36LsT6uE6v/m3kqzbrIpH7XLxIfvX9J2Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=eX1QG6NB; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Received: from [10.10.0.135] (unknown [103.163.191.245]) by linux.microsoft.com (Postfix) with ESMTPSA id CF28F20835FA; Sun, 18 Feb 2024 21:07:31 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com CF28F20835FA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1708319255; bh=9ckmFXGd+kBfCNaMSlEmhj1yDgc8H+6mbo2mOcE5h70=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=eX1QG6NBDh38Y1ba1r4IQcXzXjvy/3IC/YB3ONYiwh+fA14Ey3JEnkXNGAG10SNi+ ry3QIbOIHSLts87CmuCmoma3yGBV1T9diKhs5asSI8RqEnH884oRqPsz36NLwdz2vr di8/Le7KPXNsR/FGHfNqmQPvdTtg0kte0xrdp6m8= Message-ID: <0b3e157d-0c3f-40eb-a8a0-df4c5ae0b93a@linux.microsoft.com> Date: Mon, 19 Feb 2024 10:36:37 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] hyperv-tlfs: Change prefix of generic HV_REGISTER_* MSRs to HV_MSR_* Content-Language: en-US To: Michael Kelley , "linux-hyperv@vger.kernel.org" , "linux-kernel@vger.kernel.org" Cc: "haiyangz@microsoft.com" , "mikelley@microsoft.com" , "kys@microsoft.com" , "wei.liu@kernel.org" , "decui@microsoft.com" , "catalin.marinas@arm.com" , "tglx@linutronix.de" , "daniel.lezcano@linaro.org" , "arnd@arndb.de" References: <1707389540-6655-1-git-send-email-nunodasneves@linux.microsoft.com> From: Nuno Das Neves In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 2/10/2024 2:37 AM, Michael Kelley wrote: > > Overall, this looks good to me. It cleans up the mess I made five > years ago when first separating x86 from ARM64. :-( > > See one comment below, but otherwise, > > Reviewed-by: Michael Kelley > Thanks! Responded to your comment below. >> #if IS_ENABLED(CONFIG_HYPERV) >> -static inline unsigned int hv_get_nested_reg(unsigned int reg) >> +static inline unsigned int hv_get_nested_msr(unsigned int reg) >> { >> - if (hv_is_sint_reg(reg)) >> - return reg - HV_REGISTER_SINT0 + HV_REGISTER_NESTED_SINT0; >> + if (hv_is_sint_msr(reg)) >> + return reg - HV_MSR_SINT0 + HV_MSR_NESTED_SINT0; >> >> switch (reg) { >> - case HV_REGISTER_SIMP: >> - return HV_REGISTER_NESTED_SIMP; >> - case HV_REGISTER_SIEFP: >> - return HV_REGISTER_NESTED_SIEFP; >> - case HV_REGISTER_SVERSION: >> - return HV_REGISTER_NESTED_SVERSION; >> - case HV_REGISTER_SCONTROL: >> - return HV_REGISTER_NESTED_SCONTROL; >> - case HV_REGISTER_EOM: >> - return HV_REGISTER_NESTED_EOM; >> + case HV_MSR_SIMP: >> + return HV_MSR_NESTED_SIMP; >> + case HV_MSR_SIEFP: >> + return HV_MSR_NESTED_SIEFP; >> + case HV_MSR_SVERSION: >> + return HV_MSR_NESTED_SVERSION; >> + case HV_MSR_SCONTROL: >> + return HV_MSR_NESTED_SCONTROL; >> + case HV_MSR_EOM: >> + return HV_MSR_NESTED_EOM; >> default: >> return reg; >> } >> } > > This function is x86 specific, but you are using the generic HV_MSR_* flavor > instead of the x86 specific HV_X64_MSR_* flavor like in other x86 specific code. > Both flavors work, but I wondered if there is any reason for using the generic flavor. >> I remember debating myself the merits of one approach vs. the other, but I > don't think there was a solid argument either way. Given that you are > doing the work to get this all fixed like it should have been originally, I would > argue for being consistently one way or the other. ARM64 specific code is > *not* using the generic HV_MSR_* flavor, so I suspect x86 code should not > either. > > Michael > I see your point about keeping it consistent within the file. My thinking was that hv_get_nested_msr is not inherently x86-specific, even though it lives in arch/x86 today. However, I realize that even if this function *is* moved to generic code in the future, at that time it could be changed to the generic prefix. Doing so in this patch could be confusing since it introduces an inconsistency. So, I will take your advice and keep it HV_X64_MSR_* for everything in this file. Thanks again! Nuno