Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp176717iob; Mon, 2 May 2022 16:21:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCr8r0/Lbp7eFtymz3vCSS8ZTgMeuIlFGAP5/bAAWCsFxMQaYv8CjQxCtJfx2YGoMSmlB2 X-Received: by 2002:a63:f749:0:b0:3aa:361c:8827 with SMTP id f9-20020a63f749000000b003aa361c8827mr11604831pgk.361.1651533661863; Mon, 02 May 2022 16:21:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651533661; cv=none; d=google.com; s=arc-20160816; b=jAq0JzIuXOdBKUqCgogi71+70DhwB2QoVe6COgUE3rt9ymqAuO88/O5bayr7uts11K SifOnWPgrLFhcBmevIfAr/RcVD+B7hhVlKgl+G2qIhUUierxcwgvpNKJzN1NTpGPp/xS rnjJ+6I523SZeCF8d7QaR7tSQwAkjn+JpMEvZ3D8G2g3kPydEM5jo67Tt/HdNL26d2YJ v6EpHhX31nFCCtE1GtBerfIdPm4D0zXqLjpaLL8eCZTX6fpqQGAs5I6pUmjk3Kyr2nUg ZTXqvKwZrfkc0EG1OEmFQOIpvWixqlOGNCoxjNSAaGo6Mc3TsDwzr/+BpvmS+VGOw42u nr6w== 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=Rl14DS8awHFv+JBdruHpEbheLcyZwCqVXY9Y6bJisC4=; b=RdYrKDVKteJGyFnpCU5UUFql76XAt/UtMrjCBcjxRqwJmmugt9WX7DcNYMdprLeE/x R5rmHpn6OSjLRnKfUiKGayYioHaURaNx5pOax+Wt+zk5T9rlI3x9afyhzg4MhxesVTsp y1EUrqRNAbaitmLB5AQaA6YenUNIBEuSZwxm3LB9i5lSqLuaijGLn3u6W/Di/GVX9Ma7 JXOgNeD5cMVcqdjWFSvuYwTzmFYONPPtrb81Z+07bHdY3L+oMbhNiz6W8AbEdm2qrkR5 Wpi+OucTi0JCoZD1BkcQgFGfW6LUzpGexAP68NAn/ow8ou5iGyzNK99P9/crLV0LNIKh D2sA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IwxWBoeO; 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 y5-20020a634b05000000b003c26048dc04si1812619pga.332.2022.05.02.16.21.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 16:21:01 -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=IwxWBoeO; 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 C67FB31DCD; Mon, 2 May 2022 16:20:09 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358946AbiEBHzL (ORCPT + 99 others); Mon, 2 May 2022 03:55:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231542AbiEBHzH (ORCPT ); Mon, 2 May 2022 03:55:07 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3DA502C643 for ; Mon, 2 May 2022 00:51:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651477898; 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=Rl14DS8awHFv+JBdruHpEbheLcyZwCqVXY9Y6bJisC4=; b=IwxWBoeOkp14VZWZMWpKar2zy0dfLYl7pkFduSTGjv3cMvmogwiGTmeRv3+JWbG+Ld5saf OVacg93u4xb4+bxOkh04ZzYyyD6C91J2xV3e65mYtRuujbnEhHC6figHf9x1RTc3YTyjiR 8y8X8ss+Ez+uxh2Czvpkfcz0xutjtJk= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-669-F1M6lgvkOWmiCTPp9K9jMA-1; Mon, 02 May 2022 03:51:33 -0400 X-MC-Unique: F1M6lgvkOWmiCTPp9K9jMA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A5BC21C05148; Mon, 2 May 2022 07:51:32 +0000 (UTC) Received: from [10.72.12.86] (ovpn-12-86.pek2.redhat.com [10.72.12.86]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 745B6C52C80; Mon, 2 May 2022 07:51:26 +0000 (UTC) Reply-To: Gavin Shan Subject: Re: [PATCH v6 13/18] KVM: arm64: Support SDEI_EVENT_{COMPLETE,COMPLETE_AND_RESUME} hypercall To: Oliver Upton Cc: kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, eauger@redhat.com, Jonathan.Cameron@huawei.com, vkuznets@redhat.com, will@kernel.org, shannon.zhaosl@gmail.com, james.morse@arm.com, mark.rutland@arm.com, maz@kernel.org, pbonzini@redhat.com, shan.gavin@gmail.com References: <20220403153911.12332-1-gshan@redhat.com> <20220403153911.12332-14-gshan@redhat.com> From: Gavin Shan Message-ID: Date: Mon, 2 May 2022 15:51:23 +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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-Spam-Status: No, score=-4.2 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 Oliver, On 5/2/22 3:38 PM, Oliver Upton wrote: > On Mon, May 02, 2022 at 02:19:30PM +0800, Gavin Shan wrote: >> On 5/1/22 2:50 PM, Oliver Upton wrote: >>> On Sun, Apr 03, 2022 at 11:39:06PM +0800, Gavin Shan wrote: >>>> This supports SDEI_EVENT_{COMPLETE, COMPLETE_AND_RESUME} hypercall. >>>> They are used by guest to notify the completion of event in its >>>> handler. The previously interrupted or preempted context is restored >>>> like below. >>>> >>>> * x0 - x17, PC and PState are restored to what values we had in >>>> the interrupted or preempted context. >>>> >>>> * If it's SDEI_EVENT_COMPLETE_AND_RESUME hypercall, IRQ exception >>>> is injected. >>> >>> I don't think that's how COMPLETE_AND_RESUME works. The caller specifies an >>> address at which it would like to begin execution within the client >>> exception level. >>> >>> SDEI spec suggests this behaves like a synchronous exception. DEN 0054C >>> 5.2.2 'Event Resume Context' speaks more about how it is supposed to >>> work. >>> >> >> It's actually the linux convention. If the event handler, which was >> specified in previous hypercall to EVENT_REGISTER, returns success, >> the (linux) client calls into COMPLETE_AND_RESUME and the resume >> address is specified with FIQ vector offset. More details can be >> found from arch/arm64/kernel::sdei.c::do_sdei_event(). > > Right -- but look at what its doing. It returns the address at which it > wants to resume execution. > > arch/arm64/kernel.entry.S::__sdei_asm_handler winds up passing this as > an argument to COMPLETE_AND_RESUME. Also, what would happen if we run > something that isn't Linux inside of KVM? This is why I suggested > implementing COMPLETE_AND_RESUME in line with the specification, not > based on what the kernel is presently doing. > Indeed. The address for the resumed execution is passed by x1 when COMPLETE_AND_RESUME is called. I will figure this out in next revision. I don't think we can have the assumption that the guest is linux. Thanks again for your review and comments :) Thanks, Gavin