[{"id":1763129,"web_url":"http://patchwork.ozlabs.org/comment/1763129/","msgid":"<20170905112822.0e9319cd.cohuck@redhat.com>","list_archive_url":null,"date":"2017-09-05T09:28:22","subject":"Re: [Qemu-devel] [PATCH v2 3/3] s390x/pci: add iommu replay callback","submitter":{"id":71914,"url":"http://patchwork.ozlabs.org/api/people/71914/","name":"Cornelia Huck","email":"cohuck@redhat.com"},"content":"On Fri,  1 Sep 2017 06:22:58 +0200\nYi Min Zhao <zyimin@linux.vnet.ibm.com> wrote:\n\n> Let's introduce iommu replay callback for s390 pci iommu memory region.\n> Currently we don't need any dma mapping replay. So let it return\n> directly. This implementation will avoid meaningless loops calling\n> translation callback.\n> \n> Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>\n> Reviewed-by: Halil Pasic <pasic@linux.vnet.ibm.com>\n> Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>\n> ---\n>  hw/s390x/s390-pci-bus.c | 11 +++++++++++\n>  1 file changed, 11 insertions(+)\n> \n> diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c\n> index bd8a3e1e1c..69f45e3715 100644\n> --- a/hw/s390x/s390-pci-bus.c\n> +++ b/hw/s390x/s390-pci-bus.c\n> @@ -397,6 +397,16 @@ static IOMMUTLBEntry s390_translate_iommu(IOMMUMemoryRegion *mr, hwaddr addr,\n>      return ret;\n>  }\n>  \n> +static void s390_pci_iommu_replay(IOMMUMemoryRegion *iommu,\n> +                                  IOMMUNotifier *notifier)\n> +{\n> +    /* It's impossible to plug a pci device on s390x that already has iommu\n> +     * mappings which need to be replayed, that is due to the \"one iommu per\n> +     * zpci device\" construct. So we don't need iommu replay currently.\n\nI must say that 'currently' still throws me off. Does this refer to\nvfio? If yes, reword to something like 'Should we support migration of\nvfio-pci devices in the future, we need to revisit this.'?\n\n> +     */\n> +    return;\n> +}\n> +\n>  static S390PCIIOMMU *s390_pci_get_iommu(S390pciState *s, PCIBus *bus,\n>                                          int devfn)\n>  {\n> @@ -1045,6 +1055,7 @@ static void s390_iommu_memory_region_class_init(ObjectClass *klass, void *data)\n>      IOMMUMemoryRegionClass *imrc = IOMMU_MEMORY_REGION_CLASS(klass);\n>  \n>      imrc->translate = s390_translate_iommu;\n> +    imrc->replay = s390_pci_iommu_replay;\n>  }\n>  \n>  static const TypeInfo s390_iommu_memory_region_info = {","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx09.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx09.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=cohuck@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xmhLb0T9Mz9s0g\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue,  5 Sep 2017 19:31:51 +1000 (AEST)","from localhost ([::1]:57704 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dpACz-0000PU-42\n\tfor incoming@patchwork.ozlabs.org; Tue, 05 Sep 2017 05:31:49 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:45004)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <cohuck@redhat.com>) id 1dpA9n-0006N1-UI\n\tfor qemu-devel@nongnu.org; Tue, 05 Sep 2017 05:28:39 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <cohuck@redhat.com>) id 1dpA9j-0006g3-6b\n\tfor qemu-devel@nongnu.org; Tue, 05 Sep 2017 05:28:31 -0400","from mx1.redhat.com ([209.132.183.28]:47746)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <cohuck@redhat.com>) id 1dpA9i-0006fd-VU\n\tfor qemu-devel@nongnu.org; Tue, 05 Sep 2017 05:28:27 -0400","from smtp.corp.redhat.com\n\t(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 0E15C4ACA4;\n\tTue,  5 Sep 2017 09:28:26 +0000 (UTC)","from gondolin (dhcp-192-215.str.redhat.com [10.33.192.215])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id AC1B66F7F4;\n\tTue,  5 Sep 2017 09:28:24 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 0E15C4ACA4","Date":"Tue, 5 Sep 2017 11:28:22 +0200","From":"Cornelia Huck <cohuck@redhat.com>","To":"Yi Min Zhao <zyimin@linux.vnet.ibm.com>","Message-ID":"<20170905112822.0e9319cd.cohuck@redhat.com>","In-Reply-To":"<1504239778-29893-4-git-send-email-zyimin@linux.vnet.ibm.com>","References":"<1504239778-29893-1-git-send-email-zyimin@linux.vnet.ibm.com>\n\t<1504239778-29893-4-git-send-email-zyimin@linux.vnet.ibm.com>","Organization":"Red Hat GmbH","MIME-Version":"1.0","Content-Type":"text/plain; charset=US-ASCII","Content-Transfer-Encoding":"7bit","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.11","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.38]);\n\tTue, 05 Sep 2017 09:28:26 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [PATCH v2 3/3] s390x/pci: add iommu replay callback","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"pasic@linux.vnet.ibm.com, pmorel@linux.vnet.ibm.com,\n\trichard.henderson@linaro.org, qemu-devel@nongnu.org,\n\tagraf@suse.de, borntraeger@de.ibm.com","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1763156,"web_url":"http://patchwork.ozlabs.org/comment/1763156/","msgid":"<dc1bf02e-aea2-e1ef-904e-dc9949f97651@linux.vnet.ibm.com>","list_archive_url":null,"date":"2017-09-05T09:51:18","subject":"Re: [Qemu-devel] [PATCH v2 3/3] s390x/pci: add iommu replay callback","submitter":{"id":66807,"url":"http://patchwork.ozlabs.org/api/people/66807/","name":"Yi Min Zhao","email":"zyimin@linux.vnet.ibm.com"},"content":"在 2017/9/5 下午5:28, Cornelia Huck 写道:\n> On Fri,  1 Sep 2017 06:22:58 +0200\n> Yi Min Zhao <zyimin@linux.vnet.ibm.com> wrote:\n>\n>> Let's introduce iommu replay callback for s390 pci iommu memory region.\n>> Currently we don't need any dma mapping replay. So let it return\n>> directly. This implementation will avoid meaningless loops calling\n>> translation callback.\n>>\n>> Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>\n>> Reviewed-by: Halil Pasic <pasic@linux.vnet.ibm.com>\n>> Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>\n>> ---\n>>   hw/s390x/s390-pci-bus.c | 11 +++++++++++\n>>   1 file changed, 11 insertions(+)\n>>\n>> diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c\n>> index bd8a3e1e1c..69f45e3715 100644\n>> --- a/hw/s390x/s390-pci-bus.c\n>> +++ b/hw/s390x/s390-pci-bus.c\n>> @@ -397,6 +397,16 @@ static IOMMUTLBEntry s390_translate_iommu(IOMMUMemoryRegion *mr, hwaddr addr,\n>>       return ret;\n>>   }\n>>   \n>> +static void s390_pci_iommu_replay(IOMMUMemoryRegion *iommu,\n>> +                                  IOMMUNotifier *notifier)\n>> +{\n>> +    /* It's impossible to plug a pci device on s390x that already has iommu\n>> +     * mappings which need to be replayed, that is due to the \"one iommu per\n>> +     * zpci device\" construct. So we don't need iommu replay currently.\n> I must say that 'currently' still throws me off. Does this refer to\n> vfio? If yes, reword to something like 'Should we support migration of\n> vfio-pci devices in the future, we need to revisit this.'?\nYeah, it refers to vfio especially. I update this in next version.\n>\n>> +     */\n>> +    return;\n>> +}\n>> +\n>>   static S390PCIIOMMU *s390_pci_get_iommu(S390pciState *s, PCIBus *bus,\n>>                                           int devfn)\n>>   {\n>> @@ -1045,6 +1055,7 @@ static void s390_iommu_memory_region_class_init(ObjectClass *klass, void *data)\n>>       IOMMUMemoryRegionClass *imrc = IOMMU_MEMORY_REGION_CLASS(klass);\n>>   \n>>       imrc->translate = s390_translate_iommu;\n>> +    imrc->replay = s390_pci_iommu_replay;\n>>   }\n>>   \n>>   static const TypeInfo s390_iommu_memory_region_info = {\n>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xmhp12Jmcz9s9Y\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue,  5 Sep 2017 19:52:09 +1000 (AEST)","from localhost ([::1]:57809 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dpAWd-0000Wh-E5\n\tfor incoming@patchwork.ozlabs.org; Tue, 05 Sep 2017 05:52:07 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:59628)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <zyimin@linux.vnet.ibm.com>) id 1dpAW4-0000Sd-0Y\n\tfor qemu-devel@nongnu.org; Tue, 05 Sep 2017 05:51:36 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <zyimin@linux.vnet.ibm.com>) id 1dpAVz-00089b-3f\n\tfor qemu-devel@nongnu.org; Tue, 05 Sep 2017 05:51:32 -0400","from mx0b-001b2d01.pphosted.com ([148.163.158.5]:45268\n\thelo=mx0a-001b2d01.pphosted.com)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <zyimin@linux.vnet.ibm.com>)\n\tid 1dpAVy-00089H-Ts\n\tfor qemu-devel@nongnu.org; Tue, 05 Sep 2017 05:51:27 -0400","from pps.filterd (m0098414.ppops.net [127.0.0.1])\n\tby mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id\n\tv859nkHB126743\n\tfor <qemu-devel@nongnu.org>; Tue, 5 Sep 2017 05:51:26 -0400","from e23smtp08.au.ibm.com (e23smtp08.au.ibm.com [202.81.31.141])\n\tby mx0b-001b2d01.pphosted.com with ESMTP id 2csrt0b4d8-1\n\t(version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT)\n\tfor <qemu-devel@nongnu.org>; Tue, 05 Sep 2017 05:51:25 -0400","from localhost\n\tby e23smtp08.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use\n\tOnly! Violators will be prosecuted\n\tfor <qemu-devel@nongnu.org> from <zyimin@linux.vnet.ibm.com>;\n\tTue, 5 Sep 2017 19:51:22 +1000","from d23relay08.au.ibm.com (202.81.31.227)\n\tby e23smtp08.au.ibm.com (202.81.31.205) with IBM ESMTP SMTP Gateway:\n\tAuthorized Use Only! Violators will be prosecuted; \n\tTue, 5 Sep 2017 19:51:21 +1000","from d23av06.au.ibm.com (d23av06.au.ibm.com [9.190.235.151])\n\tby d23relay08.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id\n\tv859pLZI32374982\n\tfor <qemu-devel@nongnu.org>; Tue, 5 Sep 2017 19:51:21 +1000","from d23av06.au.ibm.com (localhost [127.0.0.1])\n\tby d23av06.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id\n\tv859pKFG003975\n\tfor <qemu-devel@nongnu.org>; Tue, 5 Sep 2017 19:51:20 +1000","from zyimindembp.cn.ibm.com (zyimindembp.cn.ibm.com [9.115.193.63])\n\tby d23av06.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id\n\tv859pILj003929; Tue, 5 Sep 2017 19:51:18 +1000"],"To":"Cornelia Huck <cohuck@redhat.com>","References":"<1504239778-29893-1-git-send-email-zyimin@linux.vnet.ibm.com>\n\t<1504239778-29893-4-git-send-email-zyimin@linux.vnet.ibm.com>\n\t<20170905112822.0e9319cd.cohuck@redhat.com>","From":"Yi Min Zhao <zyimin@linux.vnet.ibm.com>","Date":"Tue, 5 Sep 2017 17:51:18 +0800","User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)\n\tGecko/20100101 Thunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<20170905112822.0e9319cd.cohuck@redhat.com>","Content-Type":"text/plain; charset=gbk; format=flowed","X-TM-AS-MML":"disable","x-cbid":"17090509-0048-0000-0000-0000025AD6C7","X-IBM-AV-DETECTION":"SAVI=unused REMOTE=unused XFE=unused","x-cbparentid":"17090509-0049-0000-0000-0000480F32DE","Message-Id":"<dc1bf02e-aea2-e1ef-904e-dc9949f97651@linux.vnet.ibm.com>","X-Proofpoint-Virus-Version":"vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2017-09-05_04:, , signatures=0","X-Proofpoint-Spam-Details":"rule=outbound_notspam policy=outbound score=0\n\tspamscore=0 suspectscore=0\n\tmalwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam\n\tadjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000\n\tdefinitions=main-1709050152","Content-Transfer-Encoding":"quoted-printable","X-MIME-Autoconverted":"from 8bit to quoted-printable by\n\tmx0b-001b2d01.pphosted.com id v859nkHB126743","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy]","X-Received-From":"148.163.158.5","Subject":"Re: [Qemu-devel] [PATCH v2 3/3] s390x/pci: add iommu replay callback","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"pasic@linux.vnet.ibm.com, pmorel@linux.vnet.ibm.com,\n\trichard.henderson@linaro.org, qemu-devel@nongnu.org,\n\tagraf@suse.de, borntraeger@de.ibm.com","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}}]