Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE8CDC433E0 for ; Wed, 27 Jan 2021 19:20:53 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8481C64DB4 for ; Wed, 27 Jan 2021 19:20:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8481C64DB4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.76349.137722 (Exim 4.92) (envelope-from ) id 1l4qMq-0001tS-Hq; Wed, 27 Jan 2021 19:20:40 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 76349.137722; Wed, 27 Jan 2021 19:20:40 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l4qMq-0001tL-En; Wed, 27 Jan 2021 19:20:40 +0000 Received: by outflank-mailman (input) for mailman id 76349; Wed, 27 Jan 2021 19:20:38 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l4qMo-0001tG-Lp for xen-devel@lists.xenproject.org; Wed, 27 Jan 2021 19:20:38 +0000 Received: from mail-lf1-x134.google.com (unknown [2a00:1450:4864:20::134]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id c742d4dc-1caf-4cf8-a489-6d2aaec56c4a; Wed, 27 Jan 2021 19:20:37 +0000 (UTC) Received: by mail-lf1-x134.google.com with SMTP id e2so609309lfj.13 for ; Wed, 27 Jan 2021 11:20:37 -0800 (PST) Received: from [192.168.1.7] ([212.22.223.21]) by smtp.gmail.com with ESMTPSA id v25sm854659lji.85.2021.01.27.11.20.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Jan 2021 11:20:35 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c742d4dc-1caf-4cf8-a489-6d2aaec56c4a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=YG/B4Rvj4zUIVd1Ju7Q8Xa/U5H/Frs2J98Wh4dnPMzE=; b=PFmVstzs4DP4S/xkdCT1vKbHbd7nmwiAyffjUp2N7zgmgnq0ExrxUAuId3VRYWQZt7 lgALESL9rBNadvHOMxasaVAtwd4YND/YXF/Kd/JuVtgKYwlYK80Zn6yToqghX6XTx+Uq tj6qUL9U5ENS4hfXkj0OeeLyy9CnBQGahuz6LrtPsfWBcsIRECqMUN8D1AysWRu634z5 6IZnnrWl0mK4L66dxF/Xy+S5565yz7d227CHAJcGgIkeeKo4Oxa80HgSY5tW6yWi4lwQ N1EooyDDrtaKEXLYJ10+gGBa/t1H7qsKem+ct1S/GllEsDSF6GitsHYTT00mIFqrsXHF Fucw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=YG/B4Rvj4zUIVd1Ju7Q8Xa/U5H/Frs2J98Wh4dnPMzE=; b=I0rPQefldTBBsVThgPVMU7Cq5MvAbhbWfQuAnY+QRouOAfHtJ1L+nt54bp6gWGy40d C2v4wjAB3IVllu/nIOyW/WAHiMn5YfgB6hgkfGOkxdbozzow8e2/T/YMZtr8XrxLUYT6 Qy9mxEwU5f/jFuu5uBg7IC/bf+GKu9eXTSbVMFzmRbLSvEKIgIx/Wi0fyRXrUAC2aSsr KeYzNn4vRHSg4ZviabQAKbmgmgV7akb9YgOR33qW0ynFlm/xyd9i2Edu/xQTFY/fSW/j 1EUAZFZBb5j5dYrVI4SspSaRaLBSdjXx9N7R3n1+vuBKYeFyfKRq+1k9wZ6aq5EFVva6 2zWQ== X-Gm-Message-State: AOAM530OHJKZsPjn0vlWKLOoHCLgPjvIPVF3x+ms4Vw9gApQVUGszssk YQ5ItWhS6++FyzdEB0pA2BI= X-Google-Smtp-Source: ABdhPJzEqsz50zHapmQ1fvCLs9j7myKCiorTAs6xfB9OM5nE9o5fN9Aga2DZNlyu8WTlcw0Iyv24Vg== X-Received: by 2002:ac2:5b4f:: with SMTP id i15mr5606701lfp.191.1611775236490; Wed, 27 Jan 2021 11:20:36 -0800 (PST) Subject: Re: [PATCH V5 14/22] arm/ioreq: Introduce arch specific bits for IOREQ/DM features To: Julien Grall Cc: xen-devel@lists.xenproject.org, Julien Grall , Stefano Stabellini , Volodymyr Babchuk , Andrew Cooper , George Dunlap , Ian Jackson , Jan Beulich , Wei Liu , Oleksandr Tyshchenko References: <1611601709-28361-1-git-send-email-olekstysh@gmail.com> <1611601709-28361-15-git-send-email-olekstysh@gmail.com> <67136393-8454-9d28-628a-bfb380fd8fc9@xen.org> From: Oleksandr Message-ID: Date: Wed, 27 Jan 2021 21:20:30 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <67136393-8454-9d28-628a-bfb380fd8fc9@xen.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US On 27.01.21 20:33, Julien Grall wrote: Hi Julien > Hi, > > On 25/01/2021 19:08, Oleksandr Tyshchenko wrote: >> +enum io_state try_fwd_ioserv(struct cpu_user_regs *regs, >> +                             struct vcpu *v, mmio_info_t *info) >> +{ >> +    struct vcpu_io *vio = &v->io; >> +    ioreq_t p = { >> +        .type = IOREQ_TYPE_COPY, >> +        .addr = info->gpa, >> +        .size = 1 << info->dabt.size, >> +        .count = 1, >> +        .dir = !info->dabt.write, >> +        /* >> +         * On x86, df is used by 'rep' instruction to tell the >> direction >> +         * to iterate (forward or backward). >> +         * On Arm, all the accesses to MMIO region will do a single >> +         * memory access. So for now, we can safely always set to 0. >> +         */ >> +        .df = 0, >> +        .data = get_user_reg(regs, info->dabt.reg), >> +        .state = STATE_IOREQ_READY, >> +    }; >> +    struct ioreq_server *s = NULL; >> +    enum io_state rc; >> + >> +    switch ( vio->req.state ) >> +    { >> +    case STATE_IOREQ_NONE: >> +        break; >> + >> +    default: >> +        gdprintk(XENLOG_ERR, "wrong state %u\n", vio->req.state); >> +        return IO_ABORT; >> +    } > > NIT: Given there is only one case, I think this can become a: > > if ( vio->req.state != STATE_IOREQ_NONE ) > { >   gdprintk(...); >   return IO_ABORT; > } > > It is up to you whether you want to fix it now, later, or never :). V6 is planned, so will fix) > > Aside the discussion about dm.h, the rest of the code looks good to > me. It is nice to see the arch part of IOREQ is small :). I do agree, it is much smaller than it was for RFC series) Yes, I will add required changes to dm.h in the patch which introduces that header, but ... >>> So I think we may be able to drop the include from asm/hvm/domain.h (this would avoid to include it everywhere...). I have tried that, but other CUs use definitions from public/hvm/dm_op.h, for example: p2m-pt.c: In function 'p2m_type_to_flags': p2m-pt.c:87:33: error: 'XEN_DMOP_IOREQ_MEM_ACCESS_WRITE' undeclared (first use in this function)          if ( p2m->ioreq.flags & XEN_DMOP_IOREQ_MEM_ACCESS_WRITE )                                  ^ So, I would prefer to leave it as is, please let me know if you think otherwise. > > Cheers, > -- Regards, Oleksandr Tyshchenko