From patchwork Sat Oct 22 07:26:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7693 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109218wrr; Sat, 22 Oct 2022 01:47:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6STvg4aIooskrqT56QMYCCNGB2l8PG5N94PkvVJnhQnIGTfWmmCY3KM0Z1FwDk4skQCreI X-Received: by 2002:a17:907:a4e:b0:77d:94d:8148 with SMTP id be14-20020a1709070a4e00b0077d094d8148mr18534443ejc.607.1666428456150; Sat, 22 Oct 2022 01:47:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428456; cv=none; d=google.com; s=arc-20160816; b=i15cXMljna+H2hdK3h4kmRwoKutWQ14edvOcS7nxyZLAxzK9/6gPl7asbY4CMpgwNz snw+h8iWzQaEogxnPXMliPWqUU1hcZZGRCwviU/eLoZ7wsnQKJ68wruK9NeU+tsJQauQ Df/+osjU7CWlXIFV23brjT1a5cDhcY5gngbQJ34H+/DMWTFqvK6Yt6kK/s1fwfVLsmT5 kiPQmnsBwbPav1L2QyDTPfO4jF4LWfKL7utfR/eqHzITycyAviZgYNo+B/r4eiuAuULG Ciiu4faAz82odV0SSglHRGN0L6Xqvkq9BbfkBVXSLpx3R0o5/MIoaBgMkZIz4FDm9M/q F7ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cGssJP/RdnXfPAW6b1tlvKwo2OVui095ItH59m9bjSg=; b=gelS3ex/LYdPNuTtQSTSKm1nmKIPa7cljK+41c51IxEvNWpPXcUTPah4N1+D0CgEl5 AuifXI5tU690Rw0IYe+/t0hRHNZY66uz/zN58+BW3jVrOnQ6CgDm18giuKHjmHAdaVNs /bGajNJAwUMKPRtl81pSLBb4vouQmNZBzojEp9jrkmPKuhbS8ng85/Z5z/qe701BodW2 +Tt6IG1AII0G/gzN5FOL06xR6MxYIXexL4uTKHDO+oqD1vSBnv8SQHYTunQbaaJUAVzH 7yWqhZ4hd0+4dKehBxhJdyNBTdN6ZfOj4PnoH9bs58WEwFzKcaMhhHCshu3drnGSE6O/ wIDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NMfk36zT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hv9-20020a17090760c900b0078c31a71f47si21124909ejc.220.2022.10.22.01.47.11; Sat, 22 Oct 2022 01:47:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NMfk36zT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234282AbiJVIqf (ORCPT + 99 others); Sat, 22 Oct 2022 04:46:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234992AbiJVIoN (ORCPT ); Sat, 22 Oct 2022 04:44:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E82D2EBB96; Sat, 22 Oct 2022 01:08:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2D59560AC3; Sat, 22 Oct 2022 07:57:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16A41C433C1; Sat, 22 Oct 2022 07:57:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425450; bh=faVI2ltSz4dRWRF51eXeVoUuUZAOTS8lGFgE0aj/DJo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NMfk36zTdCJQzbKXAEx+gh5GoNnmtqAcmcPdEV45zUCbVjUuOFlTM/ISQSBlEpINh LXmDtmzJ1d3AD5NhXZQP/QcAa4tz9BG5DMWtXxkaB6SnuFwh6NPTTfbajuN7KxWWbJ T0Uu2Aw3EwlGOaPWCjVayF1AHE8qd3BhS0Mzx+ec= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Lynch , Haren Myneni , Michael Ellerman , Sasha Levin Subject: [PATCH 5.19 506/717] powerpc/pseries/vas: Pass hw_cpu_id to node associativity HCALL Date: Sat, 22 Oct 2022 09:26:25 +0200 Message-Id: <20221022072520.647548263@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747376884986202225?= X-GMAIL-MSGID: =?utf-8?q?1747376884986202225?= From: Haren Myneni [ Upstream commit f3e5d9e53e74d77e711a2c90a91a8b0836a9e0b3 ] Generally the hypervisor decides to allocate a window on different VAS instances. But if user space wishes to allocate on the current VAS instance where the process is executing, the kernel has to pass associativity domain IDs to allocate VAS window HCALL. To determine the associativity domain IDs for the current CPU, smp_processor_id() is passed to node associativity HCALL which may return H_P2 (-55) error during DLPAR CPU event. This is because Linux CPU numbers (smp_processor_id()) are not the same as the hypervisor's view of CPU numbers. Fix the issue by passing hard_smp_processor_id() with VPHN_FLAG_VCPU flag (PAPR 14.11.6.1 H_HOME_NODE_ASSOCIATIVITY). Fixes: b22f2d88e435 ("powerpc/pseries/vas: Integrate API with open/close windows") Reviewed-by: Nathan Lynch Signed-off-by: Haren Myneni [mpe: Update change log to mention Linux vs HV CPU numbers] Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/55380253ea0c11341824cd4c0fc6bbcfc5752689.camel@linux.ibm.com Signed-off-by: Sasha Levin --- arch/powerpc/platforms/pseries/vas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/pseries/vas.c b/arch/powerpc/platforms/pseries/vas.c index 500a1fc4a1d7..b2a32f8a837a 100644 --- a/arch/powerpc/platforms/pseries/vas.c +++ b/arch/powerpc/platforms/pseries/vas.c @@ -332,7 +332,7 @@ static struct vas_window *vas_allocate_window(int vas_id, u64 flags, * So no unpacking needs to be done. */ rc = plpar_hcall9(H_HOME_NODE_ASSOCIATIVITY, domain, - VPHN_FLAG_VCPU, smp_processor_id()); + VPHN_FLAG_VCPU, hard_smp_processor_id()); if (rc != H_SUCCESS) { pr_err("H_HOME_NODE_ASSOCIATIVITY error: %d\n", rc); goto out;