Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7454080rwb; Wed, 23 Nov 2022 06:46:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf7mHqTx7YouP06N99jC+9OUhlHJjynFt7+6TOfonddP68ZUaYjxezDFq/B08sLFfHuR2vzn X-Received: by 2002:a17:906:89a3:b0:78d:408a:4a18 with SMTP id gg35-20020a17090689a300b0078d408a4a18mr23931316ejc.261.1669214817592; Wed, 23 Nov 2022 06:46:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669214817; cv=none; d=google.com; s=arc-20160816; b=uEyESFDz9At83U5yv4xdpgPx1JHOU13XqQz5JAHKo+jGGzKFWjj+NwPr2owjuZXKEJ 6FEkw8QY7m17okOJPs0gpVEuiBR0M/RoFMedEY4WC3IFPEJM/WvI7/mxiydBqAqL7bUJ Y//7ywOENUgZyVSyqitrbKpB2re9aNwDxc10KvzCP1d7TAYIG/0vSn1uB98/9bvjypXm Llw7Lrww2oNRF96dBcLHXNXUAVtnpU4mZltTXZtDb+SMTr47dyko4TN5bTa/mPF+eW4K CsuRspag4iIV4AXX86e/XQUIGqyuGo5yhRKqp3HDif/pnCVPEf/3YKpCBLwlQsFaa8RO SNjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=O7q+XYng1M6vgFUaz+j49ftUqX+WR8ClrflugSdb5kc=; b=0092V4UVkkg68tNCI4Wh6wp8HPcMZJ8nMJQ91ww1802XTrPQrVJuwcuwMqzWZicPWG j5RbkSydj1uVB0Ica04acy4wZnv143mMf0RoxOOAfSq7AAsK5e/NPgCeouTCtCq7Mcoq kChsGVyZ0/ppEXV2QLnP8B1xHBYLiZ0zB7F2DPpGDEEFx4Qou8w0GYrro/HoXwtJ70MC LWGkr97aehmM1hAaEHUzBhILkmKMCCE+fP8inNGMFr1xf8l5saEaxHU6AJ9qkgj/zacW EnxBxLsfLpAumvTYlgosuygtgNWat3YjInSDcXydmX32UqfyktNooRLCN33iuiNaTj/P EhVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=edHq3RVn; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f17-20020a170906825100b007a1e33462c1si11124022ejx.268.2022.11.23.06.46.32; Wed, 23 Nov 2022 06:46:57 -0800 (PST) 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=@ventanamicro.com header.s=google header.b=edHq3RVn; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237787AbiKWOXm (ORCPT + 88 others); Wed, 23 Nov 2022 09:23:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239018AbiKWOXD (ORCPT ); Wed, 23 Nov 2022 09:23:03 -0500 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CCB1193F3 for ; Wed, 23 Nov 2022 06:22:57 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id v7so13193226wmn.0 for ; Wed, 23 Nov 2022 06:22:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=O7q+XYng1M6vgFUaz+j49ftUqX+WR8ClrflugSdb5kc=; b=edHq3RVn9DSBBq7CRndmDwodvYiy6GSiaortnHNkU6FOZWSCBhRhKpcbD62GCAhPw9 /QiFv4N/dcL4PCAc8CwIoWgti2RFrN1ptwSQL0NtPHwcbKbUqlyO+hcPAUD4iuJfgM/u Ttyxu3uU1BcjwRrqjOsT6g0JZlFH2GQPo0wptSB28ssX8nhyIWd/fZm21ZOVgb/f8jG7 dEj7s9ihNu16XHgRAoWDEMiIvuX851EkdduRncHXNnUCDGiUhbd1n868j6a1dG2ms/Lv Q63rnrk4Y5W3PM18eUUFU39GgY5FBU5TQAbbSFMAytnz4X22ZENR6rkQvHNZxYHni10e K2jg== 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 :message-id:reply-to; bh=O7q+XYng1M6vgFUaz+j49ftUqX+WR8ClrflugSdb5kc=; b=fTzXWkC+3wlvGr7231qAtlvsX/qPsKxAHAEsJD4oNf2TEnsya+cmvaPJbvhzlP4a8x qQOkIgCxtL0mwxPFH2cG8/yaclxuRczfoIf4x0gWTpwr+edIuWD18wHglzWFEAzaZmWo w/2EPvAkljxzOM1jFgOE83YPJGoQBF1WgaH8tIYXvyRG7Ne3p6eNM14dIyEETCRlvjpx r6bf/kXM6L0ThtOCmapClzSlBQHJvS6i7YMg3Tg/qsOB6tuwahqX/8NfQtkWojW9zUNd N9afQrcGPck1xM/6n4Vhv+aefx6CJN5cXcalfdc4OVWY2Hu7MbDUWbu4oDqTMBSFJhFy qf6w== X-Gm-Message-State: ANoB5pmy4Z3UdboM4h38o5f4d95k1pktPEQgb/7sUIQ7pAvrA5+O0X6N 56FVCy/xF9szabWkgmlWigd/rQ== X-Received: by 2002:a05:600c:a51:b0:3cf:8df5:68dc with SMTP id c17-20020a05600c0a5100b003cf8df568dcmr19412226wmq.15.1669213376042; Wed, 23 Nov 2022 06:22:56 -0800 (PST) Received: from localhost (2001-1ae9-1c2-4c00-748-2a9a-a2a6-1362.ip6.tmcz.cz. [2001:1ae9:1c2:4c00:748:2a9a:a2a6:1362]) by smtp.gmail.com with ESMTPSA id q11-20020a05600c46cb00b003c6f1732f65sm2730643wmo.38.2022.11.23.06.22.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 06:22:55 -0800 (PST) Date: Wed, 23 Nov 2022 15:22:54 +0100 From: Andrew Jones To: Atish Patra Cc: Atish Patra , linux-kernel@vger.kernel.org, Albert Ou , Anup Patel , Guo Ren , kvm-riscv@lists.infradead.org, kvm@vger.kernel.org, linux-riscv@lists.infradead.org, Mark Rutland , Palmer Dabbelt , Paul Walmsley , Will Deacon Subject: Re: [RFC 8/9] RISC-V: KVM: Implement perf support Message-ID: <20221123142254.2mc3j27kgw37jblv@kamzik> References: <20220718170205.2972215-1-atishp@rivosinc.com> <20220718170205.2972215-9-atishp@rivosinc.com> <20221101153112.hpst2bohsdvqours@kamzik> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 On Tue, Nov 22, 2022 at 04:45:16PM -0800, Atish Patra wrote: ... > This brings up another generic error returning problem in KVM SBI > land. Usually, SBI error code numbers do not > align with Linux error codes to accommodate other operating systems. > However, most of the SBI error codes > have 1-1 relationship with the Linux error code. > Thus, kvm internal code returns a Linux specific error code and > vcpu_sbi will map those to SBI error code using > kvm_linux_err_map_sbi. > > However, this will not work for SBI_ERR_ALREADY_STARTED/STOPPED as > there are no corresponding > Linux specific error codes. We can directly return the SBI error codes > from vcpu_pmu.c and modify the > kvm_linux_err_map_sbi to pass through those. In that case, we can't > map any linux error code that > collides with SBI error code. Any other ideas to handle this case ? > It seems like we should drop kvm_linux_err_map_sbi() and add another parameter to kvm_vcpu_sbi_extension.handler for the SBI error. Another option is to continue mapping SBI errors to Linux errors, e.g. SBI_ERR_ALREADY_STARTED == EBUSY, but that may not be too easy in all cases and the errors become ambiguous, as we can't tell if the Linux implementation generated the error or if the SBI call did. Thanks, drew