Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1030180pxb; Fri, 15 Apr 2022 18:56:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJye0AaGDD3ApqzuIFc6rfe5lN5k6hMhqV49U9w5yc69QxGr1zmJ27dRjD7b/VrqMQS5YWDY X-Received: by 2002:a05:6a00:21c2:b0:4fe:81f:46c7 with SMTP id t2-20020a056a0021c200b004fe081f46c7mr1593554pfj.5.1650074189915; Fri, 15 Apr 2022 18:56:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650074189; cv=none; d=google.com; s=arc-20160816; b=ye+I8NtD+XMgDtImSwul+rTMjjjEll4TJKEjc9R0ZwsLqyCMKzEuhsZTR4GQjg1PGX gqM+rga0GO1VOSYak6z1GdxB2jkMjScfDfaFH6WBOlaTIre6rXeSMdimnzGdPV/kUczt BCbo4zcpft9rOg1BHqWRXbZMSTYBWzBFela2HroE/jiGgL54CF5svEdD+jjSmVOt13eS yC4XABQihYk4p/pXge4PGD+/TIZmV7GzaCxme6h4vMgpwYJKacCyj5eigGe+/nfd7jcP n7m5itAh2u8DrPx/7Brz/SPkSNsvxishOLHyvWKXtBHDAtK7PQnEhpmgQZur9u4SaOzV DOyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:reply-to:dkim-signature; bh=mVx9cF7b07Hlw+Jyd93aqAlgfIPY+0nd7PYc9dSwC+U=; b=c2fo39W8fZLV4xXarSR3e2e0FyZ0xw3u1wb2NoKWQ+BPkw+hYtbJZweI90wPk2S8AK Y9W3h9OlMmiNn5mJ0OEtxOj12TzRJuG8wjgQ+XzokN5dmulWSYnY4kSQTlg6ke3txmq4 IQ+v47P/0Uiak0x7SgxbPnNk8QHzOMeilJbLTjoEwLgkS8Gq7NZ+weZLEzGARGRb8ara yWF6LSW5j7lV/vM7NTrlwK+XHm63+JK4RL9L5wk2ZdsXELhm4+Mo3lNPmrwbXncc+R2M Sn0D1kQf9axfYYv8SADIyn59uWUtqRMt2T2/3fUBIjIreCLsqmeCychFE51App1LQOSB +Nxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UfS9Q+8u; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id nb16-20020a17090b35d000b001cb8336d612si2933257pjb.91.2022.04.15.18.56.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 18:56:29 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UfS9Q+8u; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 553DE13AA35; Fri, 15 Apr 2022 18:17:14 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350642AbiDOGrp (ORCPT + 99 others); Fri, 15 Apr 2022 02:47:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350735AbiDOGrm (ORCPT ); Fri, 15 Apr 2022 02:47:42 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7F84BB0A4B for ; Thu, 14 Apr 2022 23:45:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650005111; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mVx9cF7b07Hlw+Jyd93aqAlgfIPY+0nd7PYc9dSwC+U=; b=UfS9Q+8ugo+f7MBqWRAQh0wo+WSzO1qaYGF785YRZ/N+8duVdAgzSnJIpk4lhsLa9KWw+N 2D7BRUqrQLbyItApdzvp2Ntc1IH/q9VbJTnMHbW8K9LgeNySdo87Ii0OZez0ULB3s+vl3P LVgvYRIHeszkZOTgfgIamck1FG1kNB4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-164-4Am9g_ddMfCYYooyATDL9w-1; Fri, 15 Apr 2022 02:45:05 -0400 X-MC-Unique: 4Am9g_ddMfCYYooyATDL9w-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 283DB801E67; Fri, 15 Apr 2022 06:45:05 +0000 (UTC) Received: from [10.72.13.171] (ovpn-13-171.pek2.redhat.com [10.72.13.171]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1C7E040CF8F6; Fri, 15 Apr 2022 06:44:58 +0000 (UTC) Reply-To: Gavin Shan Subject: Re: [PATCH v5 00/10] KVM: arm64: Add support for hypercall services selection To: Raghavendra Rao Ananta , Marc Zyngier , Andrew Jones , James Morse , Alexandru Elisei , Suzuki K Poulose Cc: kvm@vger.kernel.org, Catalin Marinas , Peter Shier , linux-kernel@vger.kernel.org, Paolo Bonzini , Will Deacon , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org References: <20220407011605.1966778-1-rananta@google.com> From: Gavin Shan Message-ID: <92eb2304-9259-0461-247f-d3a4e5eb4fd5@redhat.com> Date: Fri, 15 Apr 2022 14:44:55 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 In-Reply-To: <20220407011605.1966778-1-rananta@google.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Hi Raghavendra, On 4/7/22 9:15 AM, Raghavendra Rao Ananta wrote: > Continuing the discussion from [1], the series tries to add support > for the userspace to elect the hypercall services that it wishes > to expose to the guest, rather than the guest discovering them > unconditionally. The idea employed by the series was taken from > [1] as suggested by Marc Z. > > In a broad sense, the concept is similar to the current implementation > of PSCI interface- create a 'firmware psuedo-register' to handle the > firmware revisions. The series extends this idea to all the other > hypercalls such as TRNG (True Random Number Generator), PV_TIME > (Paravirtualized Time), and PTP (Precision Time protocol). > > For better categorization and future scaling, these firmware registers > are categorized based on the service call owners. Also, unlike the > existing firmware psuedo-registers, they hold the features supported > in the form of a bitmap. > > During the VM initialization, the registers holds an upper-limit of > the features supported by each one of them. It's expected that the > userspace discover the features provided by each register via GET_ONE_REG, > and writeback the desired values using SET_ONE_REG. KVM allows this > modification only until the VM has started. > > Some of the standard function-ids, such as ARM_SMCCC_VERSION_FUNC_ID, > need not be associated with a feature bit. For such ids, the series > introduced an allowed-list, hvc_func_default_allowed_list[], that holds > all such ids. As a result, the functions that are not elected by userspace, > or if they are not a part of this allowed-list, will be denied for when > the guests invoke them. > > Older VMMs can simply ignore this interface and the hypercall services > will be exposed unconditionally to the guests, thus ensuring backward > compatibility. > [...] I rethinking about the design again and just get one question. Hopefully, someone have the answer for us. The newly added 3 pseudo registers and the existing ones like KVM_REG_ARM_PSCI_VERSION are all tied up with vcpu, instead of VM. I don't think it's correct. I'm not sure if VM-scoped pseudo registers aren't allowed by ARM architecture or the effort isn't worthy to support it. These pseudo registers are introduced to present the available hypercalls, and then they can be disabled from userspace. In the implementation, these 3 registers are vcpu scoped. It means that multiple vcpus can be asymmetric in terms of usable hypercalls. For example, ARM_SMCCC_TRNG hypercalls can be enabled on vcpu0, but disabled on vcpu1. I don't think it's expected. On the other hand, the information stored in these 3 registers needs to be migrated through {GET,SET}_ONE_REG by VMM (QEMU). all the information stored in these 3 registers are all same on all vcpus, which is exactly as we expect. In migration circumstance, we're transporting identical information for all vcpus and it's unnecessary. Thanks, Gavin