[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH for-4.19 v2] x86/physdev: Return pirq that irq was already mapped to


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jiqian Chen <Jiqian.Chen@xxxxxxx>
  • Date: Mon, 8 Jul 2024 16:04:56 +0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bHdGyPwdZzpTLwihyTmeTsp1sAiOoMkd/UMlFggw7b8=; b=E/Umm9qAiwRf7LPpYfPkjLxdEI8IcrH1yQ5yA1Fa+ERL4pkOMwdC/zNYP2WuYTH4cgQw5BK6/3f+hW9iY6so+RGQys/WpK+dXcWLijcCeqXfMFHLvyOrikhWpjgfd8gcI4pDnQk1lokD1welmI6uTXTpFTsgMbrtEnTT9pqhTaedDGbPJp8O8OBibB9MyEuRV/Dvl/pScXu1w8+n03dEzVp5HwSybftwwflpoogey05X8WoJ2o9xhaD0d7EGzZC8RE9Pol3RjDWcr3R/6qp1UrlzBukZeQoWwWWZdZpp1bkjP+YUlI59QMMSrImoQ4KG+XppJt8YFJwTajSZYb5w5Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Vhp9a6kUBXdin96p8c8sVnGQMURpHco1/TWZuB9biUOGp8kR4Sb5tiVzZ7RTPU9GG5sHB2VHY/jDRQ+0VkMhNLKHRzo8EfvErC7vqIejUpELk041Aya+79ABH7g3ETRagdBd/hjcgAJPAwt/hWcMR2MeEG4zPVTU6XL54ZhwyDRei4bdbjX1Or0s0eby/OP8QBOVfWSHDF0DAP1evyD1cj6Dkem1gkh4w3wuapzNy5JP6UWaGYVGKZlW4TtncLID8chbCyVl4Km+y0/8+qSl8oGM6TyAk6rWvq0Sw59JC6pyaiwvUCoNrq0XvAuizZRNhKhxZDO2L/QemDjynHWDEQ==
  • Cc: Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>, "Jiqian Chen" <Jiqian.Chen@xxxxxxx>, Huang Rui <ray.huang@xxxxxxx>
  • Delivery-date: Mon, 08 Jul 2024 08:07:19 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Fix bug introduced by 0762e2502f1f ("x86/physdev: factor out the code to 
allocate and
map a pirq"). After that re-factoring, when pirq<0 and current_pirq>0, it means
caller want to allocate a free pirq for irq but irq already has a mapped pirq, 
then
it returns the negative pirq, so it fails. However, the logic before that
re-factoring is different, it should return the current_pirq that irq was 
already
mapped to and make the call success.

Fixes: 0762e2502f1f ("x86/physdev: factor out the code to allocate and map a 
pirq")

Signed-off-by: Jiqian Chen <Jiqian.Chen@xxxxxxx>
Signed-off-by: Huang Rui <ray.huang@xxxxxxx>
Signed-off-by: Jiqian Chen <Jiqian.Chen@xxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/arch/x86/irq.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index 017a94e31155..47477d88171b 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -2898,6 +2898,7 @@ static int allocate_pirq(struct domain *d, int index, int 
pirq, int irq,
                     d->domain_id, index, pirq, current_pirq);
             if ( current_pirq < 0 )
                 return -EBUSY;
+            pirq = current_pirq;
         }
         else if ( type == MAP_PIRQ_TYPE_MULTI_MSI )
         {
-- 
2.34.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.