From nobody Tue Oct 22 22:32:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1727103363; cv=none; d=zohomail.com; s=zohoarc; b=az8srvw+UmX6RR9mCr44a9BBpa6ERlS0LiaxXafCAeJFsBSSbuwM4Iwlg2tU29/MP9UExUwpmWriZ1nFSOfgGwzmEKAob+FXD3UXmmacsEYbjTZz+TnzOu+4AbcI2e4T6W0qwkyxdyHGpQSXmnl+EegLYIOKIzCDzlZWjxWp0eY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727103363; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=05jPd4xX/UdHlckKqUaC0R69EHakw7M8QVUIkCcN64o=; b=PImdK7dvOZcHww8isuuWbM2pWmznJ0BlThOS9Y3tdSV6p3vLOSwVVrrIpODMnUyg1HIeZX9+Y2CWDmAQylPuoKqO33tQgwgVGMPn2dl7yRw3/bqTKAao2jXs3Y5Cc5Q20ruLOhk4dVVY/i6JyakMwajBijo/PgKmJpUBVP6qsIw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1727103363854227.94048097051643; Mon, 23 Sep 2024 07:56:03 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.802113.1212259 (Exim 4.92) (envelope-from ) id 1sskTL-00088l-PR; Mon, 23 Sep 2024 14:55:31 +0000 Received: by outflank-mailman (output) from mailman id 802113.1212259; Mon, 23 Sep 2024 14:55:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sskTL-00088b-MG; Mon, 23 Sep 2024 14:55:31 +0000 Received: by outflank-mailman (input) for mailman id 802113; Mon, 23 Sep 2024 14:55:30 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sskTJ-0007uD-Ur for xen-devel@lists.xenproject.org; Mon, 23 Sep 2024 14:55:29 +0000 Received: from mail-vk1-xa2b.google.com (mail-vk1-xa2b.google.com [2607:f8b0:4864:20::a2b]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id deb3d32a-79bb-11ef-99a2-01e77a169b0f; Mon, 23 Sep 2024 16:55:28 +0200 (CEST) Received: by mail-vk1-xa2b.google.com with SMTP id 71dfb90a1353d-5010c0e16baso1380866e0c.1 for ; Mon, 23 Sep 2024 07:55:28 -0700 (PDT) Received: from gmail.com (ip190-5-140-142.intercom.com.sv. [190.5.140.142]) by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-5035bb38441sm3160331e0c.42.2024.09.23.07.55.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Sep 2024 07:55:26 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: deb3d32a-79bb-11ef-99a2-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727103327; x=1727708127; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=05jPd4xX/UdHlckKqUaC0R69EHakw7M8QVUIkCcN64o=; b=kPzVVfJQL4DxzEHivfWT0jnAVf5Q+1tnq5sj9rrR7UDG57zmSSc5cLO/Yv5V665swa wWENn/6s/JxQtgCQO9MWy8jlVnHSXq0G/YskFVJWKpFPJj/lurM1ifDtOHRWGwS+hhP3 hC2dk3SO9tdYZAaJdIc9B6HcVs+9KDIwewtyWkWgRmsGIfURC2WRIdvjmbtNpjVxG0rr dXlUXJVTKFDk7QMMl5TX4WsU1QKACAok+olKdBFekcUsQoCdqbFrMuj8KVqolWjCCefv Ltab9OjjkoJFqD+7MgowqSd5HRmzK/clhUWUw2gKdCyWMfTo1FmSdcDwsZWiOaW9Ywu9 +p5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727103327; x=1727708127; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=05jPd4xX/UdHlckKqUaC0R69EHakw7M8QVUIkCcN64o=; b=HI4R8u1QuMeeXa+M5dfRxuYm6B5uXTRNJfCtJXxyMGdP2genUX7lsCxsHKACKpuHGp ix/fD0wdXcyV7CZNBrNkBtY4z9Qdzbb5KvjoDAUHLcuLCvrkRfslsa0QAw68IYuG+cx0 lPqx9YWPq6imIdFpzazLppKCi+8YiaBkK0ZyuohsiciFSpzUKHfZh02Vx5oKd/tOpbjT HOiIa54wfGk4am9AKMnwsiLgrUQcdd0hDVES0nL48s1nSZsydqZWJ1SkFEm2rG8b0e7n ZeuTG1SJsABaLf0yGC0XCZTPvtBMPYBsriHZdS7kTaFQXHvUErf2UkZjIef7vTH8i4eG yA3A== X-Forwarded-Encrypted: i=1; AJvYcCVQStephgBaCaaiy72deUPUz4JGoZKHYgzSKFsRZRLEOZ93WKNnQgVMWF8Yx0gobNzyA/+OCHjvygU=@lists.xenproject.org X-Gm-Message-State: AOJu0YxSm3m7gs8Q7LkjV81/2zg+YyOjBHTvUH8TVeFp402Qjo0dRpVt kORtWrMNbcu+wZxZvn13t+14e+y/542KgNcBd52bj4CwJlOrDYnd X-Google-Smtp-Source: AGHT+IFfHsSFw/OFJznxkFoiZnCvyFR0hYfiEQEhe34nQ4WzEEcOBvN52/ulUkJnQZQXmn4i1eQUMQ== X-Received: by 2002:a05:6122:896:b0:503:e86d:d5f6 with SMTP id 71dfb90a1353d-503e86dfc36mr7223105e0c.2.1727103326722; Mon, 23 Sep 2024 07:55:26 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Cc: sstabellini@kernel.org, anthony@xenproject.org, paul@xen.org, peter.maydell@linaro.org, alex.bennee@linaro.org, edgar.iglesias@amd.com, xen-devel@lists.xenproject.org, "Edgar E. Iglesias" , Paolo Bonzini , Richard Henderson , Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum Subject: [PATCH v2 1/4] hw/xen: Expose handle_bufioreq in xen_register_ioreq Date: Mon, 23 Sep 2024 16:55:17 +0200 Message-ID: <20240923145520.1323504-2-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240923145520.1323504-1-edgar.iglesias@gmail.com> References: <20240923145520.1323504-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1727103364864116600 Content-Type: text/plain; charset="utf-8" From: "Edgar E. Iglesias" Expose handle_bufioreq in xen_register_ioreq(). This is to allow machines to enable or disable buffered ioreqs. No functional change since all callers still set it to HVM_IOREQSRV_BUFIOREQ_ATOMIC. Signed-off-by: Edgar E. Iglesias Reviewed-by: Stefano Stabellini --- hw/i386/xen/xen-hvm.c | 4 +- hw/xen/xen-hvm-common.c | 101 ++++++++++++++++++++------------ hw/xen/xen-pvh-common.c | 4 +- include/hw/xen/xen-hvm-common.h | 3 + include/hw/xen/xen_native.h | 3 +- 5 files changed, 74 insertions(+), 41 deletions(-) diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c index 4f6446600c..d3df488c48 100644 --- a/hw/i386/xen/xen-hvm.c +++ b/hw/i386/xen/xen-hvm.c @@ -614,7 +614,9 @@ void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion= **ram_memory) =20 state =3D g_new0(XenIOState, 1); =20 - xen_register_ioreq(state, max_cpus, &xen_memory_listener); + xen_register_ioreq(state, max_cpus, + HVM_IOREQSRV_BUFIOREQ_ATOMIC, + &xen_memory_listener); =20 xen_is_stubdomain =3D xen_check_stubdomain(state->xenstore); =20 diff --git a/hw/xen/xen-hvm-common.c b/hw/xen/xen-hvm-common.c index 3a9d6f981b..3ce994fc3a 100644 --- a/hw/xen/xen-hvm-common.c +++ b/hw/xen/xen-hvm-common.c @@ -667,6 +667,8 @@ static int xen_map_ioreq_server(XenIOState *state) xen_pfn_t ioreq_pfn; xen_pfn_t bufioreq_pfn; evtchn_port_t bufioreq_evtchn; + unsigned long num_frames =3D 1; + unsigned long frame =3D 1; int rc; =20 /* @@ -675,59 +677,79 @@ static int xen_map_ioreq_server(XenIOState *state) */ QEMU_BUILD_BUG_ON(XENMEM_resource_ioreq_server_frame_bufioreq !=3D 0); QEMU_BUILD_BUG_ON(XENMEM_resource_ioreq_server_frame_ioreq(0) !=3D 1); + + if (state->has_bufioreq) { + frame =3D 0; + num_frames =3D 2; + } state->fres =3D xenforeignmemory_map_resource(xen_fmem, xen_domid, XENMEM_resource_ioreq_server, - state->ioservid, 0, 2, + state->ioservid, + frame, num_frames, &addr, PROT_READ | PROT_WRITE, 0); if (state->fres !=3D NULL) { trace_xen_map_resource_ioreq(state->ioservid, addr); - state->buffered_io_page =3D addr; - state->shared_page =3D addr + XC_PAGE_SIZE; + state->shared_page =3D addr; + if (state->has_bufioreq) { + state->buffered_io_page =3D addr; + state->shared_page =3D addr + XC_PAGE_SIZE; + } } else if (errno !=3D EOPNOTSUPP) { error_report("failed to map ioreq server resources: error %d handl= e=3D%p", errno, xen_xc); return -1; } =20 - rc =3D xen_get_ioreq_server_info(xen_domid, state->ioservid, - (state->shared_page =3D=3D NULL) ? - &ioreq_pfn : NULL, - (state->buffered_io_page =3D=3D NULL) ? - &bufioreq_pfn : NULL, - &bufioreq_evtchn); - if (rc < 0) { - error_report("failed to get ioreq server info: error %d handle=3D%= p", - errno, xen_xc); - return rc; - } - - if (state->shared_page =3D=3D NULL) { + /* + * If we fail to map the shared page with xenforeignmemory_map_resourc= e() + * or if we're using buffered ioreqs, we need xen_get_ioreq_server_inf= o() + * to provide the the addresses to map the shared page and/or to get t= he + * event-channel port for buffered ioreqs. + */ + if (state->shared_page =3D=3D NULL || state->has_bufioreq) { trace_xen_map_ioreq_server_shared_page(ioreq_pfn); + rc =3D xen_get_ioreq_server_info(xen_domid, state->ioservid, + (state->shared_page =3D=3D NULL) ? + &ioreq_pfn : NULL, + (state->has_bufioreq && + state->buffered_io_page =3D=3D NUL= L) ? + &bufioreq_pfn : NULL, + &bufioreq_evtchn); + if (rc < 0) { + error_report("failed to get ioreq server info: error %d handle= =3D%p", + errno, xen_xc); + return rc; + } =20 - state->shared_page =3D xenforeignmemory_map(xen_fmem, xen_domid, - PROT_READ | PROT_WRITE, - 1, &ioreq_pfn, NULL); + if (state->shared_page =3D=3D NULL) { + trace_xen_map_ioreq_server_shared_page(ioreq_pfn); + + state->shared_page =3D xenforeignmemory_map(xen_fmem, xen_domi= d, + PROT_READ | PROT_WRI= TE, + 1, &ioreq_pfn, NULL); + } if (state->shared_page =3D=3D NULL) { error_report("map shared IO page returned error %d handle=3D%p= ", errno, xen_xc); } - } =20 - if (state->buffered_io_page =3D=3D NULL) { - trace_xen_map_ioreq_server_buffered_io_page(bufioreq_pfn); + if (state->has_bufioreq && state->buffered_io_page =3D=3D NULL) { + trace_xen_map_ioreq_server_buffered_io_page(bufioreq_pfn); =20 - state->buffered_io_page =3D xenforeignmemory_map(xen_fmem, xen_dom= id, - PROT_READ | PROT_WR= ITE, - 1, &bufioreq_pfn, - NULL); - if (state->buffered_io_page =3D=3D NULL) { - error_report("map buffered IO page returned error %d", errno); - return -1; + state->buffered_io_page =3D xenforeignmemory_map(xen_fmem, xen= _domid, + PROT_READ | PROT_W= RITE, + 1, &bufioreq_pfn, + NULL); + if (state->buffered_io_page =3D=3D NULL) { + error_report("map buffered IO page returned error %d", err= no); + return -1; + } } } =20 - if (state->shared_page =3D=3D NULL || state->buffered_io_page =3D=3D N= ULL) { + if (state->shared_page =3D=3D NULL || + (state->has_bufioreq && state->buffered_io_page =3D=3D NULL)) { return -1; } =20 @@ -830,14 +852,15 @@ static void xen_do_ioreq_register(XenIOState *state, state->ioreq_local_port[i] =3D rc; } =20 - rc =3D qemu_xen_evtchn_bind_interdomain(state->xce_handle, xen_domid, - state->bufioreq_remote_port); - if (rc =3D=3D -1) { - error_report("buffered evtchn bind error %d", errno); - goto err; + if (state->has_bufioreq) { + rc =3D qemu_xen_evtchn_bind_interdomain(state->xce_handle, xen_dom= id, + state->bufioreq_remote_port); + if (rc =3D=3D -1) { + error_report("buffered evtchn bind error %d", errno); + goto err; + } + state->bufioreq_local_port =3D rc; } - state->bufioreq_local_port =3D rc; - /* Init RAM management */ #ifdef XEN_COMPAT_PHYSMAP xen_map_cache_init(xen_phys_offset_to_gaddr, state); @@ -865,6 +888,7 @@ err: } =20 void xen_register_ioreq(XenIOState *state, unsigned int max_cpus, + uint8_t handle_bufioreq, const MemoryListener *xen_memory_listener) { int rc; @@ -883,7 +907,8 @@ void xen_register_ioreq(XenIOState *state, unsigned int= max_cpus, goto err; } =20 - rc =3D xen_create_ioreq_server(xen_domid, &state->ioservid); + state->has_bufioreq =3D handle_bufioreq !=3D HVM_IOREQSRV_BUFIOREQ_OFF; + rc =3D xen_create_ioreq_server(xen_domid, handle_bufioreq, &state->ios= ervid); if (!rc) { xen_do_ioreq_register(state, max_cpus, xen_memory_listener); } else { diff --git a/hw/xen/xen-pvh-common.c b/hw/xen/xen-pvh-common.c index 28d7168446..08641fdcec 100644 --- a/hw/xen/xen-pvh-common.c +++ b/hw/xen/xen-pvh-common.c @@ -194,7 +194,9 @@ static void xen_pvh_init(MachineState *ms) } =20 xen_pvh_init_ram(s, sysmem); - xen_register_ioreq(&s->ioreq, ms->smp.max_cpus, &xen_memory_listener); + xen_register_ioreq(&s->ioreq, ms->smp.max_cpus, + HVM_IOREQSRV_BUFIOREQ_ATOMIC, + &xen_memory_listener); =20 if (s->cfg.virtio_mmio_num) { xen_create_virtio_mmio_devices(s); diff --git a/include/hw/xen/xen-hvm-common.h b/include/hw/xen/xen-hvm-commo= n.h index 3d796235dc..0f586c4384 100644 --- a/include/hw/xen/xen-hvm-common.h +++ b/include/hw/xen/xen-hvm-common.h @@ -81,6 +81,8 @@ typedef struct XenIOState { QLIST_HEAD(, XenPciDevice) dev_list; DeviceListener device_listener; =20 + bool has_bufioreq; + Notifier exit; } XenIOState; =20 @@ -95,6 +97,7 @@ void xen_device_unrealize(DeviceListener *listener, Devic= eState *dev); =20 void xen_hvm_change_state_handler(void *opaque, bool running, RunState rst= ate); void xen_register_ioreq(XenIOState *state, unsigned int max_cpus, + uint8_t handle_bufioreq, const MemoryListener *xen_memory_listener); =20 void cpu_ioreq_pio(ioreq_t *req); diff --git a/include/hw/xen/xen_native.h b/include/hw/xen/xen_native.h index 1a5ad693a4..5caf91a616 100644 --- a/include/hw/xen/xen_native.h +++ b/include/hw/xen/xen_native.h @@ -464,10 +464,11 @@ static inline void xen_unmap_pcidev(domid_t dom, } =20 static inline int xen_create_ioreq_server(domid_t dom, + int handle_bufioreq, ioservid_t *ioservid) { int rc =3D xendevicemodel_create_ioreq_server(xen_dmod, dom, - HVM_IOREQSRV_BUFIOREQ_ATOM= IC, + handle_bufioreq, ioservid); =20 if (rc =3D=3D 0) { --=20 2.43.0 From nobody Tue Oct 22 22:32:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1727103371; cv=none; d=zohomail.com; s=zohoarc; b=Vpdl4Hd0QwLDsWyS/bBsTq3Vbvu6gm1POTwQ2AcUpVJOjiWkjdqlubXfb1ATic61PcrzLp2d2/Im8iT4wIb+hCrOLW4gMy70LIwhmg/6tkcISJyw6uFZ0BAiHaLbEDIkKOL1t81xuJDdiQ1nF9fdy4aW4ow59Bhw/2qj3r3R7N4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727103371; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=pBoxVH+Ru8Cf8WZg/qIWXUyc6DjCMqmFHFamf1lm7RE=; b=Rae8mQyP52JD9XRQ/dx4AGaBq8pjgXwuk7A3uNnYoR7FMGrWiOplmlazRIa2mW3VPpu1agMi/VRs1RjYyiPThUaQQJOZSSI/YTTydS/Swdn7GctaxqR+/V6jzE6ZUHtFQv9uiVk5tWuAgxS1+aP6dFnQtl8IyxTmVQfLMSNx0PY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 17271033693261015.4993583123564; Mon, 23 Sep 2024 07:56:09 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.802114.1212265 (Exim 4.92) (envelope-from ) id 1sskTM-0008FT-65; Mon, 23 Sep 2024 14:55:32 +0000 Received: by outflank-mailman (output) from mailman id 802114.1212265; Mon, 23 Sep 2024 14:55:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sskTM-0008DB-22; Mon, 23 Sep 2024 14:55:32 +0000 Received: by outflank-mailman (input) for mailman id 802114; Mon, 23 Sep 2024 14:55:31 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sskTL-0007uD-Gt for xen-devel@lists.xenproject.org; Mon, 23 Sep 2024 14:55:31 +0000 Received: from mail-vs1-xe2b.google.com (mail-vs1-xe2b.google.com [2607:f8b0:4864:20::e2b]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id dfcc3d57-79bb-11ef-99a2-01e77a169b0f; Mon, 23 Sep 2024 16:55:29 +0200 (CEST) Received: by mail-vs1-xe2b.google.com with SMTP id ada2fe7eead31-49bc13c3a47so1759540137.3 for ; Mon, 23 Sep 2024 07:55:29 -0700 (PDT) Received: from gmail.com (ip190-5-140-142.intercom.com.sv. [190.5.140.142]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-849399971dfsm3226559241.26.2024.09.23.07.55.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Sep 2024 07:55:27 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: dfcc3d57-79bb-11ef-99a2-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727103329; x=1727708129; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pBoxVH+Ru8Cf8WZg/qIWXUyc6DjCMqmFHFamf1lm7RE=; b=dX5sjy9+yWLfarf1scATDY2zpEhlwdFAeBqML8Ad1gxK6jAUTKLmlu8SlraW11LKxE aiQMKyPqbnocbWV1h+SQLF80tdlH2yMgPpmr5pLbl37Sf88GR8bdkKxRLX/Y9qiFhMki Y3G8KdP+oFMb/vuxQBwWQcCAx8L/trqRyTDyqwBCQ+oBIFPPBK9XMI9b46PhN0xLrdLV DblqQMaeQbKECM0sPCYw5FSvOjCzf+twxpzPQlmM4JMuMThrKcni+8hrD3M+y1+78HgJ ASiaAell2Z0L2tlIhvSUAkIrCeTTkmL2WC1cswvny2GyeAtUw25nZZMugQls3gy8NWSr rmsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727103329; x=1727708129; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pBoxVH+Ru8Cf8WZg/qIWXUyc6DjCMqmFHFamf1lm7RE=; b=Gv2ohFFychS416vGOJBvhH4GIg0yqK+82cChO+K6v5CKXjs1hfc3OOmzfaV20405X5 jkeXuf9sjqjSvqKP3akrxYY+ntN/HnZ2MEMixKz8IDUguHVwdvZKGGtp26IZHOlVDsYl qkoc0VNS/LNUQePL5Cjiw4l+VtInwGQMItxRvbIKp3g5rn+fyToaZWv/aoj0PsqoiA1r j1BXBvxJT1JyttZzCfAy2opauy/ZuUP3goYitnn8lV31OSTVjb9rS57fser9+1rwQKC3 18zZrSKwXxgv+ZFe7yVy/DmLpUSx2oHdbPH6N0phrgCUSb/3N/Q5zw2K6Wspe4IqqSek eA6g== X-Forwarded-Encrypted: i=1; AJvYcCWK93c/PsutYevBUHJoB0RJ+UDBNw166+En1JB5QYjOZTwdVChhNucu/HfLwZ/9dFrSpYEgH6zOeUI=@lists.xenproject.org X-Gm-Message-State: AOJu0Yw5ow+kpNnNrUj/Js1/WAez3zUDzzWJZfnkCRKn+FdsfbI0s50S CgmQga0ZMnW29lJI79I2pgNIkjw6YjqOgoG5t6SHsm/psRyOecGu X-Google-Smtp-Source: AGHT+IEVIq+5zTRJIDiwVEZ//hmPV3dnxQ6KGiEO/YrKl7+YpgOR25Qn3clhu6UZuNekZAImrbXJhA== X-Received: by 2002:a05:6102:94c:b0:498:e25c:738f with SMTP id ada2fe7eead31-49fc7624bf3mr7212517137.18.1727103328687; Mon, 23 Sep 2024 07:55:28 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Cc: sstabellini@kernel.org, anthony@xenproject.org, paul@xen.org, peter.maydell@linaro.org, alex.bennee@linaro.org, edgar.iglesias@amd.com, xen-devel@lists.xenproject.org, "Edgar E. Iglesias" , Paolo Bonzini , Richard Henderson , Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , qemu-arm@nongnu.org Subject: [PATCH v2 2/4] hw/xen: xenpvh: Disable buffered IOREQs for ARM Date: Mon, 23 Sep 2024 16:55:18 +0200 Message-ID: <20240923145520.1323504-3-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240923145520.1323504-1-edgar.iglesias@gmail.com> References: <20240923145520.1323504-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1727103372790116600 Content-Type: text/plain; charset="utf-8" From: "Edgar E. Iglesias" Add a way to enable/disable buffered IOREQs for PVH machines and disable them for ARM. ARM does not support buffered IOREQ's nor the legacy way to map IOREQ info pages. See the following for more details: https://xenbits.xen.org/gitweb/?p=3Dxen.git;a=3Dcommitdiff;h=3D2fbd7e609e18= 03ac5e5c26e22aa8e4b5a6cddbb1 https://xenbits.xen.org/gitweb/?p=3Dxen.git;a=3Dblob;f=3Dxen/arch/arm/ioreq= .c;h=3D2e829d2e7f3760401b96fa7c930e2015fb1cf463;hb=3DHEAD#l138 Signed-off-by: Edgar E. Iglesias Reviewed-by: Stefano Stabellini --- hw/arm/xen-pvh.c | 3 +++ hw/i386/xen/xen-pvh.c | 3 +++ hw/xen/xen-pvh-common.c | 2 +- include/hw/xen/xen-pvh-common.h | 3 +++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/hw/arm/xen-pvh.c b/hw/arm/xen-pvh.c index 04cb9855af..28af3910ea 100644 --- a/hw/arm/xen-pvh.c +++ b/hw/arm/xen-pvh.c @@ -66,6 +66,9 @@ static void xen_arm_machine_class_init(ObjectClass *oc, v= oid *data) */ mc->max_cpus =3D GUEST_MAX_VCPUS; =20 + /* Xen/ARM does not use buffered IOREQs. */ + xpc->handle_bufioreq =3D HVM_IOREQSRV_BUFIOREQ_OFF; + /* List of supported features known to work on PVH ARM. */ xpc->has_tpm =3D true; xpc->has_virtio_mmio =3D true; diff --git a/hw/i386/xen/xen-pvh.c b/hw/i386/xen/xen-pvh.c index 45645667e9..f1f02d3311 100644 --- a/hw/i386/xen/xen-pvh.c +++ b/hw/i386/xen/xen-pvh.c @@ -89,6 +89,9 @@ static void xen_pvh_machine_class_init(ObjectClass *oc, v= oid *data) /* We have an implementation specific init to create CPU objects. */ xpc->init =3D xen_pvh_init; =20 + /* Enable buffered IOREQs. */ + xpc->handle_bufioreq =3D HVM_IOREQSRV_BUFIOREQ_ATOMIC; + /* * PCI INTX routing. * diff --git a/hw/xen/xen-pvh-common.c b/hw/xen/xen-pvh-common.c index 08641fdcec..76a9b2b945 100644 --- a/hw/xen/xen-pvh-common.c +++ b/hw/xen/xen-pvh-common.c @@ -195,7 +195,7 @@ static void xen_pvh_init(MachineState *ms) =20 xen_pvh_init_ram(s, sysmem); xen_register_ioreq(&s->ioreq, ms->smp.max_cpus, - HVM_IOREQSRV_BUFIOREQ_ATOMIC, + xpc->handle_bufioreq, &xen_memory_listener); =20 if (s->cfg.virtio_mmio_num) { diff --git a/include/hw/xen/xen-pvh-common.h b/include/hw/xen/xen-pvh-commo= n.h index bc09eea936..5cdd23c2f4 100644 --- a/include/hw/xen/xen-pvh-common.h +++ b/include/hw/xen/xen-pvh-common.h @@ -43,6 +43,9 @@ struct XenPVHMachineClass { */ int (*set_pci_link_route)(uint8_t line, uint8_t irq); =20 + /* Allow implementations to optionally enable buffered ioreqs. */ + uint8_t handle_bufioreq; + /* * Each implementation can optionally enable features that it * supports and are known to work. --=20 2.43.0 From nobody Tue Oct 22 22:32:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1727103363; cv=none; d=zohomail.com; s=zohoarc; b=JjE2n92qnZ2faWMeVUYP6fdB7rNkbmlnjI85LMJhR90Y1vAi+sc6rsfGj93b6fmMQ8ilC9QOQXIr3LUGPx7asth27NRV9jf02f9FPQXYm7hbwnZlppKgtfN9704sp6ntl/Sq58lF/rbY4jI1BHtetr7QASjjtCP3t9+laYVqgTw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727103363; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Mm+KI23c86LD33sZYRxxXCIhV12T/Ywht8Xuz1hXe+0=; b=jVttTLa0TcDvJvlghEPYhugCeZ8EJrlXVpvJspwnL1SSDEtrkRcWeMnxwIiLrGyepJLVrgIl9BhYIEMHjre+NtwlQ9kWdLPjOds5LNTd8e8uFCxdNaey/jRQtv7UDztG6WgRNROIiTwG09LGZaAXpT9xZiBqN9O5e7Q07TQs4M8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1727103363434548.9832628131414; Mon, 23 Sep 2024 07:56:03 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.802115.1212279 (Exim 4.92) (envelope-from ) id 1sskTN-0000BB-EJ; Mon, 23 Sep 2024 14:55:33 +0000 Received: by outflank-mailman (output) from mailman id 802115.1212279; Mon, 23 Sep 2024 14:55:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sskTN-0000Ay-BE; Mon, 23 Sep 2024 14:55:33 +0000 Received: by outflank-mailman (input) for mailman id 802115; Mon, 23 Sep 2024 14:55:32 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sskTM-0008CV-Ai for xen-devel@lists.xenproject.org; Mon, 23 Sep 2024 14:55:32 +0000 Received: from mail-ua1-x92e.google.com (mail-ua1-x92e.google.com [2607:f8b0:4864:20::92e]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id e0bb6bbb-79bb-11ef-a0b9-8be0dac302b0; Mon, 23 Sep 2024 16:55:31 +0200 (CEST) Received: by mail-ua1-x92e.google.com with SMTP id a1e0cc1a2514c-846d414ea6bso1215708241.3 for ; Mon, 23 Sep 2024 07:55:31 -0700 (PDT) Received: from gmail.com (ip190-5-140-142.intercom.com.sv. [190.5.140.142]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-49e6b345c6fsm3737705137.14.2024.09.23.07.55.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Sep 2024 07:55:29 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: e0bb6bbb-79bb-11ef-a0b9-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727103330; x=1727708130; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Mm+KI23c86LD33sZYRxxXCIhV12T/Ywht8Xuz1hXe+0=; b=UGfJ6uamWktd9AjfsJ2If4zOxyXIUuiGljzyAzxwWnkXqlTx0Dr+5j2Rz+iCIXBZHS T2LSrNDh1huebP9RldmQF3w3F+ZIFd9JYS8tX464NW+D9XEJpfGu/TQLJgSWMf+TWqkO 69v/ho9HNZ/KRZSXjvS2aBF5H4SooPt2yFX/xZCDFIQhGBwY48OSiUq4difUOzF7cVJW rw48CNtFqjAZA+F0BmjgixsUlTy5euLdrv4QC8kQm6rztlAn7+7Bi52H09q1MRo3LAN+ irPiHJ8qmu980bgXDgQwnr+v27hC61ZMC/3iDc3WUGs4jjbepbKJrVUJ8QlI2i+uZcLu p3eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727103330; x=1727708130; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Mm+KI23c86LD33sZYRxxXCIhV12T/Ywht8Xuz1hXe+0=; b=qE5/TqmgXPJ6++PVA8BATHjUZrCDUsb9RIjFu/5YjO3/VWF1siAamrN2epl/0EiAAo nhrjsFQj3bKjg/1ukxmghlZ35rHvWxV3+1ZBGIMAPr25808t5KDUAVRSPQQWsUXtEh2X gP2jNlDaHNJcuHS+EQHir7T1zYW2xozsF8ATo83O11145O3xYuDqJ5sK2BEm59d10uY0 ve0uJEYKyFZuvEdwuzqxBPqsheLUoNt8d8PgBCKZP6bGm0Fc5QNqPEudXtEFtF3GTaFY nwBF4A+ll2A/poSrArwkpWUDSQnx8FrIni6TtRKl0SqnagHrTG8e+LAR2WGWTDgPSmSg Z0OA== X-Forwarded-Encrypted: i=1; AJvYcCX+44FBE5O6tLyEl63X6C+bKMLc9KX1UiPELJ0gJ7nKjy7yJd+4WFpXBtxu6aZF6CYRroBAu/GV7PU=@lists.xenproject.org X-Gm-Message-State: AOJu0YyL1v79XYiCZdWqGPJJPy8u2GvnwGsdEUC7FfSX3iwWq35yDlQR XZXI4lOp6O/3HWkCxKkRXP9YlmhHogaqd4jQs2TiMMa7KxRnXqf8 X-Google-Smtp-Source: AGHT+IEa6GHCw5xlUAShPHcRXsaKLJmNVozEJN7ykRDnN4Q6tHZqrG6CPQ/VSMwl2li6QGRnqSqpWQ== X-Received: by 2002:a05:6102:e09:b0:48f:4898:f2a9 with SMTP id ada2fe7eead31-49fc765b22emr8402772137.25.1727103330312; Mon, 23 Sep 2024 07:55:30 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Cc: sstabellini@kernel.org, anthony@xenproject.org, paul@xen.org, peter.maydell@linaro.org, alex.bennee@linaro.org, edgar.iglesias@amd.com, xen-devel@lists.xenproject.org, "Edgar E. Iglesias" Subject: [PATCH v2 3/4] hw/xen: xenpvh: Add pci-intx-irq-base property Date: Mon, 23 Sep 2024 16:55:19 +0200 Message-ID: <20240923145520.1323504-4-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240923145520.1323504-1-edgar.iglesias@gmail.com> References: <20240923145520.1323504-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1727103364715116600 Content-Type: text/plain; charset="utf-8" From: "Edgar E. Iglesias" Acked-by: Stefano Stabellini Signed-off-by: Edgar E. Iglesias --- hw/xen/xen-pvh-common.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/hw/xen/xen-pvh-common.c b/hw/xen/xen-pvh-common.c index 76a9b2b945..218ac851cf 100644 --- a/hw/xen/xen-pvh-common.c +++ b/hw/xen/xen-pvh-common.c @@ -218,6 +218,11 @@ static void xen_pvh_init(MachineState *ms) error_report("pci-ecam-size only supports values 0 or 0x100000= 00"); exit(EXIT_FAILURE); } + if (!s->cfg.pci_intx_irq_base) { + error_report("PCI enabled but pci-intx-irq-base not set"); + exit(EXIT_FAILURE); + } + xenpvh_gpex_init(s, xpc, sysmem); } =20 @@ -273,6 +278,30 @@ XEN_PVH_PROP_MEMMAP(pci_ecam) XEN_PVH_PROP_MEMMAP(pci_mmio) XEN_PVH_PROP_MEMMAP(pci_mmio_high) =20 +static void xen_pvh_set_pci_intx_irq_base(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + XenPVHMachineState *xp =3D XEN_PVH_MACHINE(obj); + uint32_t value; + + if (!visit_type_uint32(v, name, &value, errp)) { + return; + } + + xp->cfg.pci_intx_irq_base =3D value; +} + +static void xen_pvh_get_pci_intx_irq_base(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + XenPVHMachineState *xp =3D XEN_PVH_MACHINE(obj); + uint32_t value =3D xp->cfg.pci_intx_irq_base; + + visit_type_uint32(v, name, &value, errp); +} + void xen_pvh_class_setup_common_props(XenPVHMachineClass *xpc) { ObjectClass *oc =3D OBJECT_CLASS(xpc); @@ -318,6 +347,13 @@ do { = \ OC_MEMMAP_PROP(oc, "pci-ecam", pci_ecam); OC_MEMMAP_PROP(oc, "pci-mmio", pci_mmio); OC_MEMMAP_PROP(oc, "pci-mmio-high", pci_mmio_high); + + object_class_property_add(oc, "pci-intx-irq-base", "uint32_t", + xen_pvh_get_pci_intx_irq_base, + xen_pvh_set_pci_intx_irq_base, + NULL, NULL); + object_class_property_set_description(oc, "pci-intx-irq-base", + "Set PCI INTX interrupt base line."); } =20 #ifdef CONFIG_TPM --=20 2.43.0 From nobody Tue Oct 22 22:32:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1727103361; cv=none; d=zohomail.com; s=zohoarc; b=k/o2xkTxiaUB1VqoaEuvUj3MD25L6WMxoKHtRXI/a+5CB8Dc69kYmjHozwcfy0joHLBRPz2209EBGazy6Liza7kPsU++6cn+SXQShF3StXn8ZCREhomQnu1ZiYlkKnlKQFKZcOQ+iiEPZlw8lgkpBnlo7dnMPmqc8uCqtom970M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727103361; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=7NqZgDSIdmym8k9v4wrElx9POiJdcsjS85l4BMSFw2Y=; b=crqmezh36KF55XY9Rb+xlpbuhI3gQgaXMb8r10Dy09atQVxk4NsdGqWC57g2es+uakoHImeyozeR2POtJY4IT44gVn9ScgAtQ0p+M0xKJfr7pdpA+O6fDMqToCEdOBH91/4B8o4u5fp0WPmo0QkzKzgzt3C2fxMFwROBcf8R4c4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1727103361675745.9147537026391; Mon, 23 Sep 2024 07:56:01 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.802116.1212289 (Exim 4.92) (envelope-from ) id 1sskTP-0000U7-NS; Mon, 23 Sep 2024 14:55:35 +0000 Received: by outflank-mailman (output) from mailman id 802116.1212289; Mon, 23 Sep 2024 14:55:35 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sskTP-0000Tv-Jx; Mon, 23 Sep 2024 14:55:35 +0000 Received: by outflank-mailman (input) for mailman id 802116; Mon, 23 Sep 2024 14:55:34 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sskTO-0008CV-1u for xen-devel@lists.xenproject.org; Mon, 23 Sep 2024 14:55:34 +0000 Received: from mail-vk1-xa2b.google.com (mail-vk1-xa2b.google.com [2607:f8b0:4864:20::a2b]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id e1e5f026-79bb-11ef-a0b9-8be0dac302b0; Mon, 23 Sep 2024 16:55:33 +0200 (CEST) Received: by mail-vk1-xa2b.google.com with SMTP id 71dfb90a1353d-501192e8e12so783705e0c.3 for ; Mon, 23 Sep 2024 07:55:33 -0700 (PDT) Received: from gmail.com (ip190-5-140-142.intercom.com.sv. [190.5.140.142]) by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-503d7e9ea08sm1784841e0c.31.2024.09.23.07.55.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Sep 2024 07:55:31 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: e1e5f026-79bb-11ef-a0b9-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727103332; x=1727708132; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7NqZgDSIdmym8k9v4wrElx9POiJdcsjS85l4BMSFw2Y=; b=c3zmEOxBUbhJ1weKwK+180TKxzIClliqO+M+JgiNoGh+4Qpa4MaM2l3kvhdONLqI++ 1NCvHm8fNrcuQO2AC33m3Du8jrNRpUI8F3qdVZIK01mbInrEPgd72jBzbwm+lZQ4Twqo Bw2WxWX6Z/RCUplYO/8bUxYM8mbdkBE4i3L/CbRkwe5Gj6JcVOqI6hGBWQV40TqY4LOk jjjnb68PKk/zKv0zHo4lraIVjyQJf459e7fEqXcOoMl1vjyQXqP6fXY9h96lb+G552Ix 5g0L4HOHMNR7mvFr/ADLy7nQUnI7J31EXGWCOUnEgU5ZLn16o9YrydYUNZPwREXmLX73 v7dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727103332; x=1727708132; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7NqZgDSIdmym8k9v4wrElx9POiJdcsjS85l4BMSFw2Y=; b=eOf0S8jFj7GEyIbx7yIvkJ6LZz6puRzkXbhp/2V8a/jS0K9GYVpAx9IU3uJg7eI1xo +TLcMNdMuuUMOAOaUInurUgjDbn9Zu58MaWSi+43dDLr7DIsUZpzGo36TQ8Jmth3qcjb SWYa3ekCQX1aYlZfRUj9w3922Z0GbRndNGHQGWsEF9OqREpEL/F84NTEvXulJgjBfHKj 6Yi+4OAgGSCc/YHgUifq1HveBeY+vGpBcO2YNxh4YAwLUif49XAJsLBWo1gpdxTduW75 W3Z1QGVvApAWjQnUgRQHs2IGCXtknORdP0SO83QtbQoXwotUx/ODCn1X3eqmfUzM4QA5 g79w== X-Forwarded-Encrypted: i=1; AJvYcCWSWeWAlYMwoxEi49aR2QJD4JzOK52aMe0ihDfF5XpF7QCvEUwZTuLit9Q2Om1UPgTMJ3hnkJY3wwE=@lists.xenproject.org X-Gm-Message-State: AOJu0YzSkAqk2A7f5SimRCVRXP0ZgQPCmT9+H0wgEt032qiRpO0Rgz4C O0BGmGoNRbmyFNjiKsCfOYtfvmI2n/ZnKHtS0C+TPsUydXSwRG5C X-Google-Smtp-Source: AGHT+IG6dbA1Qoykmc5DxVHIT6I9aGC0+8n371MVri28ok0pj3/lLGZ93yQkgFm3m0GB4zJqdCuIOQ== X-Received: by 2002:a05:6122:3c91:b0:4f6:e87d:5160 with SMTP id 71dfb90a1353d-503e04cc2ffmr6905503e0c.9.1727103332294; Mon, 23 Sep 2024 07:55:32 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Cc: sstabellini@kernel.org, anthony@xenproject.org, paul@xen.org, peter.maydell@linaro.org, alex.bennee@linaro.org, edgar.iglesias@amd.com, xen-devel@lists.xenproject.org, qemu-arm@nongnu.org Subject: [PATCH v2 4/4] hw/arm: xenpvh: Enable PCI for ARM PVH Date: Mon, 23 Sep 2024 16:55:20 +0200 Message-ID: <20240923145520.1323504-5-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240923145520.1323504-1-edgar.iglesias@gmail.com> References: <20240923145520.1323504-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1727103362765116600 Content-Type: text/plain; charset="utf-8" From: "Edgar E. Iglesias" Enable PCI support for the ARM Xen PVH machine. Reviewed-by: Stefano Stabellini Signed-off-by: Edgar E. Iglesias --- hw/arm/xen-pvh.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/hw/arm/xen-pvh.c b/hw/arm/xen-pvh.c index 28af3910ea..33f0dd5982 100644 --- a/hw/arm/xen-pvh.c +++ b/hw/arm/xen-pvh.c @@ -39,6 +39,16 @@ static void xen_arm_instance_init(Object *obj) VIRTIO_MMIO_DEV_SIZE }; } =20 +static void xen_pvh_set_pci_intx_irq(void *opaque, int intx_irq, int level) +{ + XenPVHMachineState *s =3D XEN_PVH_MACHINE(opaque); + int irq =3D s->cfg.pci_intx_irq_base + intx_irq; + + if (xendevicemodel_set_irq_level(xen_dmod, xen_domid, irq, level)) { + error_report("xendevicemodel_set_pci_intx_level failed"); + } +} + static void xen_arm_machine_class_init(ObjectClass *oc, void *data) { XenPVHMachineClass *xpc =3D XEN_PVH_MACHINE_CLASS(oc); @@ -69,7 +79,11 @@ static void xen_arm_machine_class_init(ObjectClass *oc, = void *data) /* Xen/ARM does not use buffered IOREQs. */ xpc->handle_bufioreq =3D HVM_IOREQSRV_BUFIOREQ_OFF; =20 + /* PCI INTX delivery. */ + xpc->set_pci_intx_irq =3D xen_pvh_set_pci_intx_irq; + /* List of supported features known to work on PVH ARM. */ + xpc->has_pci =3D true; xpc->has_tpm =3D true; xpc->has_virtio_mmio =3D true; =20 --=20 2.43.0