From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 58AF1C43458 for ; Thu, 2 Jul 2026 06:39:10 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.1351253.1608476 (Exim 4.92) (envelope-from ) id 1wfB4X-0002AB-Cs; Thu, 02 Jul 2026 06:38:53 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1351253.1608476; Thu, 02 Jul 2026 06:38:53 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wfB4X-0002A4-9m; Thu, 02 Jul 2026 06:38:53 +0000 Received: by outflank-mailman (input) for mailman id 1351253; Thu, 02 Jul 2026 06:38:51 +0000 Received: from mx.expurgate.net ([194.145.224.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wfB4V-00029y-N7 for xen-devel@lists.xenproject.org; Thu, 02 Jul 2026 06:38:51 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wfB4U-006Bsb-Ih for xen-devel@lists.xenproject.org; Thu, 02 Jul 2026 08:38:50 +0200 Received: from [10.42.69.1] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a460764-5cb7-0a2a0a5109dd-0a2a45019a46-48 for ; Thu, 02 Jul 2026 08:38:50 +0200 Received: from [209.85.128.42] (helo=mail-wm1-f42.google.com) by tlsNG-d62444.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a46077a-400f-0a2a45010019-d155802abc05-3 for ; Thu, 02 Jul 2026 08:38:50 +0200 Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4921eed3fa2so9643035e9.0 for ; Wed, 01 Jul 2026 23:38:50 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-493c6354771sm23124965e9.3.2026.07.01.23.38.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 01 Jul 2026 23:38:49 -0700 (PDT) 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" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=suse.com header.i="@suse.com" header.h="Content-Transfer-Encoding:In-Reply-To:Autocrypt:From:Content-Language:References:Cc:To:Subject:User-Agent:MIME-Version:Date:Message-ID" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1782974330; x=1783579130; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=tTOdo7r99vUeIh+Bzq2POYKkkUa284xP30k/bUUTVmc=; b=Ru6umzU/0upR/Q9bI2KbSz9MApTTg+VmlyE1IwhsLTImbn2ASsiZm6CdLfO7ZYPD61 AGmdv6vn2mCzJDCSurOiecM4tv7aUbIZrG+7DfsJuZPIvpeYCBvYOEQ8Pp+UGiO+eP/1 1yumUkG5YhuTG6IQ8qh4N+Gm09vbrlqJKQNr3ul0O65pSJ/jLmZNsfh2JQ/H2wN6bprV Q7eXoPXnUYfxhVvlzcwOg8qtcGYjh7S3Lq0Gkx+p/7z+yYgQjPMoJ5EnLupL623XSKIr vwdMDFjwC5cFEUbt51xe5gV9tTYsxDoytVQzEEJCq6BThCgNHDrQ14uLwZ4wIErg6Vbw aTHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782974330; x=1783579130; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=tTOdo7r99vUeIh+Bzq2POYKkkUa284xP30k/bUUTVmc=; b=F60kKyMu9RUZl0KXqlE3GqabnvrkS7QhElSOZbArqNza0FE8KZPE2Er2LY8pIUmymp LxkjBD2UV8CjLQMD7i3udOZ8yuhttIMnnenqynihL7UfR+Y35UW321iwRWnyMqxrcuuL iMYpGRyB0zUKIyjwxZXNAdhNcUFilcj+i1PwMMqRG/BJ6rJJdX7DRkSGsKRV18kbaf9Y JVhwcAY1FFRxuflCc1jY6AoQ6WXr4vx1ipLbOqGxOcs8IWG3B1IR+hG95doz4XMMVHqt eY6UL53mY2MMpmGAZoQpfoYv/c0/L37SfMFVSeFfj6kLeJglnlKWV/uU/Xv4VLZmv0Qz nV8g== X-Forwarded-Encrypted: i=1; AFNElJ+Ql92VWBnIn4SuFavGvRtzIxgyT7YL5s9U6zM2bdaEFl6wO3xGShBfZ+FYZ4y1KIFvfW9XzP8TcQc=@lists.xenproject.org X-Gm-Message-State: AOJu0YxSTLovz5+cRsGjHFEMFUmluNeCWkQpAxhOluA814y0eDi/w/bX wzMHMx2OD1/nnzuzY1nUXpA0OUGKPDw4YoEqMriamH72NWzP3p/hvBqQE2jWIkYfVw== X-Gm-Gg: AfdE7ckIPzkWCVD8l1b9p/eB6Tq4hL4TIOwv/vAsJtPrkX7NT1hN8S5JaqRvz/bZ3Mx 4ERlEZeo7nwC/EKXnVPqOXEOXgPXWc4SRVQvwwpAtapYMvQEl4FNmTlMrYVqCIuR9WQqiv0fpGv JU9tve8TBIHYMORgHqci2zkrh10/6PY9xLmLaro06W3QF9POKE//Qdr37erTP2BqWWx1hSTt7fZ IS9gVuSd2hGDUpEhqQwPs3OsOFIieZmXvxUPH11piGR+JlpqejzKIbPhZP1S9bt+gA8r6BCHnZU 2xXVPvkjFkGc3IsRNi9auCtQ5WFKgSGYmPzVWWNJrdHdsz2uyhfNBlHkQZC2M2i15aGmfQ8li6z 8WpwEdOL1bW35qwjdR/6gDiZv6bpPj51iLVNTSagmg5uZ2p+fahob4gJaIhVJs+TxVznsAJFNlz +iHzKCt1MLMgaGBlO5ankBOv/qTpvZfCBRzzG0JEvSibEmfATJgxJ4hQxpoyLqR54N1/QujP3rk hUc X-Received: by 2002:a05:600c:8590:b0:492:4363:e7eb with SMTP id 5b1f17b1804b1-493c2ba4f75mr52259095e9.32.1782974329984; Wed, 01 Jul 2026 23:38:49 -0700 (PDT) Message-ID: <40bcf6b7-306a-419a-bf12-1855f9e589fe@suse.com> Date: Thu, 2 Jul 2026 08:38:48 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 21/25] xen/riscv: implement IRQ routing for device passthrough To: Oleksii Kurochko Cc: Romain Caritey , Baptiste Le Duc , Alistair Francis , Connor Davis , "Daniel P. Smith" , xen-devel@lists.xenproject.org References: <472a77604d35a0bc2a75b71f250fd67b63afde4c.1782487661.git.oleksii.kurochko@gmail.com> <6aafbeb5-2f33-49f4-9d14-937b0bc4d15d@gmail.com> Content-Language: en-US From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9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ybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <6aafbeb5-2f33-49f4-9d14-937b0bc4d15d@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-purgate-ID: tlsNG-d62444/1782974330-D16DE1E0-82700991/0/0 X-purgate-type: clean X-purgate-size: 1953 On 01.07.2026 16:49, Oleksii Kurochko wrote: > On 6/29/26 5:55 PM, Jan Beulich wrote: >> On 26.06.2026 17:46, Oleksii Kurochko wrote: >>> @@ -221,3 +239,215 @@ void do_IRQ(struct cpu_user_regs *regs, unsigned int irq) >>> spin_unlock(&desc->lock); >>> irq_exit(); >>> } >>> + >>> +static inline struct irq_guest *irq_get_guest_info(struct irq_desc *desc) >>> +{ >>> + ASSERT(spin_is_locked(&desc->lock)); >>> + ASSERT(test_bit(_IRQ_GUEST, &desc->status)); >>> + ASSERT(desc->action != NULL); >>> + >>> + return desc->action->dev_id; >>> +} >>> + >>> +static inline struct domain *irq_get_domain(struct irq_desc *desc) >>> +{ >>> + return irq_get_guest_info(desc)->d; >>> +} >> >> Does this really need a separate helper? (You effectively open-code it >> anyway in release_guest_irq().) > > Considering that I used irq_get_domain() once at all (even in > downstream) I will drop that. Good. >> For both functions: "inline" generally wants limiting to header files. > > Regarding inline I think that I don't understand, it isn't in the header > file as irq_get_guest_info() is used only in this file. Right. I didn't as it to move to a header file. > Do I understand you correctly and it is needed just to drop "inline" for > irq_get_guest_info()? Yes. It can be simply static here, and the compiler can figure out whether to inline it. >>> + spin_unlock_irqrestore(&desc->lock, flags); >>> + >>> + release_irq(desc->irq, info); >>> + xvfree(info); >> >> If, in release_irq(), action isn't freed, it's ->dev_id field will now have >> a dangling pointer. (I think I did point this out before.) > > It should freed in release_irq() as route_irq_to_guest() always set > action->free_on_release = true; Well, "free_on_release" must exits for a purpose. I.e. there must be, now or soon, cases where it's set to false. Else simply drop the field. Jan