Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp147069lqt; Mon, 18 Mar 2024 04:22:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWOClSeWil/v9mI7yQszbXcPRy/EBzkKc8O/E245cmps01caJxuSVkukPW+fJOnMnVqz3HGK8qo8YXbCK75jeJQ7kzMivdrP11Mx8Mz8g== X-Google-Smtp-Source: AGHT+IF6l3KBNclF9BxJOem5y1K+jBbipA/uMcInndIQuqwzQD8uVQO1istyyY7HxfXas7e2z12C X-Received: by 2002:a17:907:7f87:b0:a46:a9db:1471 with SMTP id qk7-20020a1709077f8700b00a46a9db1471mr4029063ejc.16.1710760974671; Mon, 18 Mar 2024 04:22:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710760974; cv=pass; d=google.com; s=arc-20160816; b=XCcaUvDZ31T8dUCWfzqMGRJSfvAZe9+34JyqN93uO7GgdzSjo0ZERNOLIVIP5hEzAH 2O7qjJ2Tv5PoDSa6qtaem+6Fe2zfS2UGuo1jl8dD4XvGggrIgZyDzON0ANY4sellM7Kh 106SUWnXNh8OrjYsb7Crc6vz6wid6n36dCDmpFZuVgMYc7neCJVZjzSgIWA6l1p0/OW7 3zpNdL4L7pH/qh/67ijSy2fBrH7OZKrKoUyXYjaFGGjcfZ88PcZA49OgqCM8HKZitoER Kf7GuKvzx/GQntrvDhoIrzcHBk19X/YmfIrT1JqN7vSXkiTsg/vk8ztuko+SAC45bABm Q5Iw== 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:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=60B6vUvxc9exa6ymSIvcx3Q5ko0BCebA1kjdfTUV76M=; fh=oJQf9vf9Iao1c/CxH0qy0VgVNHy2SVb4lqxByEImyWQ=; b=l9Y3jxIn0M3X0zZPs1fHUOxgx59bRAX9k/7h1V99C9UQHKe89jnnNTD7GD+6Z7e8U+ hIwWgk+Tvzo+LooXudRqv3hmVWgAjQWAN1bf40j/4M8YQPd/ucbiyOdsz48rw4CpahTY aWNRtlRYutvE6SxQTR4gGl2zAD+SbsbqJqqTqKWNU+spHhCYa6uk9elsq39C39Qy2yk8 /PaT6s250o6WsHPhKxsZEvd4gFieKXhu8XOkpP16dl/gpiMG95zCSEGN6Xh20Jx4sYxK iG9x0TofLyZH4LCPBJ6oA0+y4Bm6WGzl4PlugOf1Eu/jBWv91kAHjgOp2NXIIQXVFp/V BnwQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-106061-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106061-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id lf12-20020a170907174c00b00a4642a02ccesi4245024ejc.840.2024.03.18.04.22.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 04:22:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-106061-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-106061-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106061-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 668931F22271 for ; Mon, 18 Mar 2024 11:22:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 70CC136AF6; Mon, 18 Mar 2024 11:22:45 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5EFEA2E651; Mon, 18 Mar 2024 11:22:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710760964; cv=none; b=hpyE29rU+6wIz2Fsep3SfLDl0VTPEASUVbuZjoFEAKLq5YKfAJ2Q/ck0wMwiPpgKA9Eurw0TdCu/CP55mv3JMbrah396Y6wddvfBKNyNudkJhnCXfTyOyQIm/wMKt725OjgSQzMFieIiWOxTNj8Lqmq8o7JtU16Lwcz/1Mvn3DY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710760964; c=relaxed/simple; bh=VJmGLdrpLC4M2layVFICfKfdaErWKxnf2M1uTyH1ek0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=l21PV2Yvz0VLH6Njia9JBGzReXTda5lkXLAbr60ibBWOvLmx92vxZnP6lv8uZjxXrwjVw7oyOPPwV+saoXLCMLqGGnMty0bFYqVFw6k7/kfsZ5KUJtghqg6cm6j8I09L/bfBpljbXkBD5sB0TJHDK4Uhvnja9fnIe3A+hb3GlyA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A857BDA7; Mon, 18 Mar 2024 04:23:17 -0700 (PDT) Received: from [10.57.12.69] (unknown [10.57.12.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 55E0C3F762; Mon, 18 Mar 2024 04:22:39 -0700 (PDT) Message-ID: <4809297b-a2f4-45a2-9005-884232a35b75@arm.com> Date: Mon, 18 Mar 2024 11:22:39 +0000 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: [RFC PATCH 06/28] arm64: RME: ioctls to create and configure realms To: Ganapatrao Kulkarni , kvm@vger.kernel.org, kvmarm@lists.linux.dev Cc: Catalin Marinas , Marc Zyngier , Will Deacon , James Morse , Oliver Upton , Suzuki K Poulose , Zenghui Yu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Joey Gouly , Alexandru Elisei , Christoffer Dall , Fuad Tabba , linux-coco@lists.linux.dev References: <20230127112248.136810-1-suzuki.poulose@arm.com> <20230127112932.38045-1-steven.price@arm.com> <20230127112932.38045-7-steven.price@arm.com> Content-Language: en-GB From: Steven Price In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks for taking a look at this. On 18/03/2024 07:40, Ganapatrao Kulkarni wrote: > On 27-01-2023 04:59 pm, Steven Price wrote: [...] >>   int kvm_init_rme(void) >>   { >> +    int ret; >> + >>       if (PAGE_SIZE != SZ_4K) >>           /* Only 4k page size on the host is supported */ >>           return 0; >> @@ -43,6 +394,12 @@ int kvm_init_rme(void) >>           /* Continue without realm support */ >>           return 0; >>   +    ret = rme_vmid_init(); >> +    if (ret) >> +        return ret; >> + >> +    WARN_ON(rmi_features(0, &rmm_feat_reg0)); > > Why WARN_ON, Is that good enough to print err/info message and keep > "kvm_rme_is_available" disabled? Good point. RMI_FEATURES "does not have any failure conditions" so this is very much a "should never happen" situation. Assuming the call gracefully fails then rmm_feat_reg0 would remain 0 which would in practise stop realms being created, but this is clearly non-ideal. I'll fix this up in the next version to do the rmi_features() call before rme_vmid_init(), that way we can just return early without setting kvm_rme_is_available in this situation. I'll keep the WARN_ON because something has gone very wrong if this call fails. > IMO, we should print message when rme is enabled, otherwise it should be > silent return. The rmi_check_version() call already outputs a "RMI ABI version %d.%d" message - I don't want to be too noisy here. Other than the 'cannot happen' situations if you see the "RMI ABI" message then kvm_rme_is_available will be set. And those 'cannot happen' routes will print their own error message (and point to a seriously broken system). And obviously in the case of SMC_RMI_VERSION not being supported then we silently return as this is taken to mean there isn't an RMM. Thanks, Steve