From nobody Fri May 3 07:36:19 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1583588667; cv=none; d=zohomail.com; s=zohoarc; b=HkC7sV75S14DaO5Sm4cd72ibONxByxASzaTGw6oeq7EFeC97D1uDg+XMxLgLmb/IfasHy7lQhegIxNmxFjymDsL61WYHpykVXvUp/FQ5abZQiP5ai5tgBO3HdtHQ1xpG9g6lXs005Kw9lvpgI26plyaR2NxgrU1xIrdgp6YnwiQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583588667; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=D0D2k3HAwxOJpZCxyzVB7tzFl1/JV0F3otc8EO6Jxfo=; b=lNt4pS9LuSFZwMaVEZepWuWi4oVfAp4ga3XcFCjlY1HHgQ3tHqYH8m9EzclcxKefet0HiDR1ki5eH71rQ12cPK55p1XqNU1qotHXSY4ZhhvFjry4oectF9OLuSR4B/tj9ppEIkOnJC7piSQdRjEhsTXz5iG20LZHP/kl9SAgdMc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 158358866716965.7753384962109; Sat, 7 Mar 2020 05:44:27 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jAZjn-000788-1X; Sat, 07 Mar 2020 13:43:31 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jAZjl-000783-Pk for xen-devel@lists.xenproject.org; Sat, 07 Mar 2020 13:43:29 +0000 Received: from mail-wm1-x342.google.com (unknown [2a00:1450:4864:20::342]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 9f95cc88-6079-11ea-b52f-bc764e2007e4; Sat, 07 Mar 2020 13:43:27 +0000 (UTC) Received: by mail-wm1-x342.google.com with SMTP id u9so5251390wml.3 for ; Sat, 07 Mar 2020 05:43:27 -0800 (PST) Received: from kbp1-lhp-F74019 (a81-14-236-68.net-htp.de. [81.14.236.68]) by smtp.gmail.com with ESMTPSA id j14sm53414628wrn.32.2020.03.07.05.43.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 07 Mar 2020 05:43:25 -0800 (PST) X-Inumbo-ID: 9f95cc88-6079-11ea-b52f-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=UzOq6FF3akuPLC3LG/nbtpm2iPPVNKaEhYdMK/V4DS4=; b=UxH22wuIfNxM82dg41VB6fdmI5cHQGp7lvwz2K44E4mz3F0f5GHU2mxBHC37JWyqmd Md54KEzvLJrC5II5SVOAZAWo5YomNxm4E3gzfkRQQdzuntKfM7L/qOGHd30MK8RKrBia WZ3M70xMqxT/YWEXZmh6yB2V8GFH8eZlzpMnZ1VJWQIuuJxdoJCRivcSsXp/Jjm7PFwc m56aDwmPRK54zeNED70EFkJQwga3CwY9xRABEiIDFSX7MogzfA6kHe7Ht2gfoJXkjM9T 0/qsFFve91XPjDHSbCok0pMrO/T1gxp8W44QukzspJW08wQFJGdPTkBuEmXqbFcdUnWp ormA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=UzOq6FF3akuPLC3LG/nbtpm2iPPVNKaEhYdMK/V4DS4=; b=ilbNhgv5EVYVo7h8NlCludMANewHTIStDNbQr8w8U6lM0XWLFPwWZly5G5AD9oQoe8 Y0HR455x+gXnKgPnw9akzL/z1yDWufXeOqllcPDtNtsQLcobglaNpxFaMoUsk3ySTGlb t2obSWvNLiOXbtT0WJXutQ7M+pdpppfyOJ9BxDcXCCWitG80udQCE8SrVRdKxnBrkN2Z S8SChd3nExLBfo8lSTjCWjxHSUjX6bF2qzsk1xC4Yon+AdmBfh4G1PR0XLP1CjUBSFkN LbtKEgb5cSiCesk9r6MNdgT2SVAe10eRMAA/JSTWKtHtNZtl3NEjZiabLAhN48Gq06EF P81w== X-Gm-Message-State: ANhLgQ0wRR8mW8VW7/W+5f0tE2u4aY19dnWazA2ckbW2QZMsXxX8j/nr JVbQ2juHx83Jh6j9eq9KxHQ= X-Google-Smtp-Source: ADFU+vsUs+QmAkT5XOB9p9rVquO+gT1CLcpyghqwj6qHtOYCQ/Bvz0SzGyyVrDxQX64Hrp5P5Vk1JA== X-Received: by 2002:a05:600c:2214:: with SMTP id z20mr9508158wml.57.1583588606301; Sat, 07 Mar 2020 05:43:26 -0800 (PST) Date: Sat, 7 Mar 2020 15:43:22 +0200 From: Yan Yankovskyi To: Boris Ostrovsky , Jan Beulich Message-ID: <20200307134322.GA27756@kbp1-lhp-F74019> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) Subject: [Xen-devel] [PATCH v2] xen: Use evtchn_type_t as a type for event channels X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , xen-devel@lists.xenproject.org, Stefano Stabellini , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Make event channel functions pass event channel port using evtchn_port_t type. It eliminates signed <-> unsigned conversion. Signed-off-by: Yan Yankovskyi --- drivers/xen/events/events_2l.c | 16 +++--- drivers/xen/events/events_base.c | 83 ++++++++++++++------------- drivers/xen/events/events_fifo.c | 22 +++---- drivers/xen/events/events_internal.h | 30 +++++----- drivers/xen/evtchn.c | 13 +++-- drivers/xen/pvcalls-back.c | 5 +- drivers/xen/xen-pciback/xenbus.c | 7 ++- drivers/xen/xen-scsiback.c | 3 +- drivers/xen/xenbus/xenbus_client.c | 6 +- include/xen/events.h | 20 +++---- include/xen/interface/event_channel.h | 2 +- include/xen/xenbus.h | 4 +- 12 files changed, 109 insertions(+), 102 deletions(-) diff --git a/drivers/xen/events/events_2l.c b/drivers/xen/events/events_2l.c index 8edef51c92e5..64df919a2111 100644 --- a/drivers/xen/events/events_2l.c +++ b/drivers/xen/events/events_2l.c @@ -53,37 +53,37 @@ static void evtchn_2l_bind_to_cpu(struct irq_info *info= , unsigned cpu) set_bit(info->evtchn, BM(per_cpu(cpu_evtchn_mask, cpu))); } =20 -static void evtchn_2l_clear_pending(unsigned port) +static void evtchn_2l_clear_pending(evtchn_port_t port) { struct shared_info *s =3D HYPERVISOR_shared_info; sync_clear_bit(port, BM(&s->evtchn_pending[0])); } =20 -static void evtchn_2l_set_pending(unsigned port) +static void evtchn_2l_set_pending(evtchn_port_t port) { struct shared_info *s =3D HYPERVISOR_shared_info; sync_set_bit(port, BM(&s->evtchn_pending[0])); } =20 -static bool evtchn_2l_is_pending(unsigned port) +static bool evtchn_2l_is_pending(evtchn_port_t port) { struct shared_info *s =3D HYPERVISOR_shared_info; return sync_test_bit(port, BM(&s->evtchn_pending[0])); } =20 -static bool evtchn_2l_test_and_set_mask(unsigned port) +static bool evtchn_2l_test_and_set_mask(evtchn_port_t port) { struct shared_info *s =3D HYPERVISOR_shared_info; return sync_test_and_set_bit(port, BM(&s->evtchn_mask[0])); } =20 -static void evtchn_2l_mask(unsigned port) +static void evtchn_2l_mask(evtchn_port_t port) { struct shared_info *s =3D HYPERVISOR_shared_info; sync_set_bit(port, BM(&s->evtchn_mask[0])); } =20 -static void evtchn_2l_unmask(unsigned port) +static void evtchn_2l_unmask(evtchn_port_t port) { struct shared_info *s =3D HYPERVISOR_shared_info; unsigned int cpu =3D get_cpu(); @@ -173,7 +173,7 @@ static void evtchn_2l_handle_events(unsigned cpu) /* Timer interrupt has highest priority. */ irq =3D irq_from_virq(cpu, VIRQ_TIMER); if (irq !=3D -1) { - unsigned int evtchn =3D evtchn_from_irq(irq); + evtchn_port_t evtchn =3D evtchn_from_irq(irq); word_idx =3D evtchn / BITS_PER_LONG; bit_idx =3D evtchn % BITS_PER_LONG; if (active_evtchns(cpu, s, word_idx) & (1ULL << bit_idx)) @@ -228,7 +228,7 @@ static void evtchn_2l_handle_events(unsigned cpu) =20 do { xen_ulong_t bits; - int port; + evtchn_port_t port; =20 bits =3D MASK_LSBS(pending_bits, bit_idx); =20 diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_b= ase.c index 499eff7d3f65..06f6cb01af39 100644 --- a/drivers/xen/events/events_base.c +++ b/drivers/xen/events/events_base.c @@ -116,7 +116,7 @@ static void clear_evtchn_to_irq_all(void) } } =20 -static int set_evtchn_to_irq(unsigned evtchn, unsigned irq) +static int set_evtchn_to_irq(evtchn_port_t evtchn, unsigned int irq) { unsigned row; unsigned col; @@ -143,7 +143,7 @@ static int set_evtchn_to_irq(unsigned evtchn, unsigned = irq) return 0; } =20 -int get_evtchn_to_irq(unsigned evtchn) +int get_evtchn_to_irq(evtchn_port_t evtchn) { if (evtchn >=3D xen_evtchn_max_channels()) return -1; @@ -162,7 +162,7 @@ struct irq_info *info_for_irq(unsigned irq) static int xen_irq_info_common_setup(struct irq_info *info, unsigned irq, enum xen_irq_type type, - unsigned evtchn, + evtchn_port_t evtchn, unsigned short cpu) { int ret; @@ -184,7 +184,7 @@ static int xen_irq_info_common_setup(struct irq_info *i= nfo, } =20 static int xen_irq_info_evtchn_setup(unsigned irq, - unsigned evtchn) + evtchn_port_t evtchn) { struct irq_info *info =3D info_for_irq(irq); =20 @@ -193,7 +193,7 @@ static int xen_irq_info_evtchn_setup(unsigned irq, =20 static int xen_irq_info_ipi_setup(unsigned cpu, unsigned irq, - unsigned evtchn, + evtchn_port_t evtchn, enum ipi_vector ipi) { struct irq_info *info =3D info_for_irq(irq); @@ -207,7 +207,7 @@ static int xen_irq_info_ipi_setup(unsigned cpu, =20 static int xen_irq_info_virq_setup(unsigned cpu, unsigned irq, - unsigned evtchn, + evtchn_port_t evtchn, unsigned virq) { struct irq_info *info =3D info_for_irq(irq); @@ -220,7 +220,7 @@ static int xen_irq_info_virq_setup(unsigned cpu, } =20 static int xen_irq_info_pirq_setup(unsigned irq, - unsigned evtchn, + evtchn_port_t evtchn, unsigned pirq, unsigned gsi, uint16_t domid, @@ -253,7 +253,7 @@ unsigned int evtchn_from_irq(unsigned irq) return info_for_irq(irq)->evtchn; } =20 -unsigned irq_from_evtchn(unsigned int evtchn) +unsigned int irq_from_evtchn(evtchn_port_t evtchn) { return get_evtchn_to_irq(evtchn); } @@ -304,7 +304,7 @@ unsigned cpu_from_irq(unsigned irq) return info_for_irq(irq)->cpu; } =20 -unsigned int cpu_from_evtchn(unsigned int evtchn) +unsigned int cpu_from_evtchn(evtchn_port_t evtchn) { int irq =3D get_evtchn_to_irq(evtchn); unsigned ret =3D 0; @@ -354,7 +354,7 @@ static void bind_evtchn_to_cpu(unsigned int chn, unsign= ed int cpu) */ void notify_remote_via_irq(int irq) { - int evtchn =3D evtchn_from_irq(irq); + evtchn_port_t evtchn =3D evtchn_from_irq(irq); =20 if (VALID_EVTCHN(evtchn)) notify_remote_via_evtchn(evtchn); @@ -445,7 +445,7 @@ static void xen_free_irq(unsigned irq) irq_free_desc(irq); } =20 -static void xen_evtchn_close(unsigned int port) +static void xen_evtchn_close(evtchn_port_t port) { struct evtchn_close close; =20 @@ -472,7 +472,7 @@ static void pirq_query_unmask(int irq) =20 static void eoi_pirq(struct irq_data *data) { - int evtchn =3D evtchn_from_irq(data->irq); + evtchn_port_t evtchn =3D evtchn_from_irq(data->irq); struct physdev_eoi eoi =3D { .irq =3D pirq_from_irq(data->irq) }; int rc =3D 0; =20 @@ -508,7 +508,7 @@ static unsigned int __startup_pirq(unsigned int irq) { struct evtchn_bind_pirq bind_pirq; struct irq_info *info =3D info_for_irq(irq); - int evtchn =3D evtchn_from_irq(irq); + evtchn_port_t evtchn =3D evtchn_from_irq(irq); int rc; =20 BUG_ON(info->type !=3D IRQT_PIRQ); @@ -561,7 +561,7 @@ static void shutdown_pirq(struct irq_data *data) { unsigned int irq =3D data->irq; struct irq_info *info =3D info_for_irq(irq); - unsigned evtchn =3D evtchn_from_irq(irq); + evtchn_port_t evtchn =3D evtchn_from_irq(irq); =20 BUG_ON(info->type !=3D IRQT_PIRQ); =20 @@ -601,7 +601,7 @@ EXPORT_SYMBOL_GPL(xen_irq_from_gsi); =20 static void __unbind_from_irq(unsigned int irq) { - int evtchn =3D evtchn_from_irq(irq); + evtchn_port_t evtchn =3D evtchn_from_irq(irq); struct irq_info *info =3D irq_get_handler_data(irq); =20 if (info->refcnt > 0) { @@ -827,7 +827,7 @@ int xen_pirq_from_irq(unsigned irq) } EXPORT_SYMBOL_GPL(xen_pirq_from_irq); =20 -int bind_evtchn_to_irq(unsigned int evtchn) +int bind_evtchn_to_irq(evtchn_port_t evtchn) { int irq; int ret; @@ -870,8 +870,8 @@ EXPORT_SYMBOL_GPL(bind_evtchn_to_irq); static int bind_ipi_to_irq(unsigned int ipi, unsigned int cpu) { struct evtchn_bind_ipi bind_ipi; - int evtchn, irq; - int ret; + evtchn_port_t evtchn; + int ret, irq; =20 mutex_lock(&irq_mapping_update_lock); =20 @@ -909,7 +909,7 @@ static int bind_ipi_to_irq(unsigned int ipi, unsigned i= nt cpu) } =20 int bind_interdomain_evtchn_to_irq(unsigned int remote_domain, - unsigned int remote_port) + evtchn_port_t remote_port) { struct evtchn_bind_interdomain bind_interdomain; int err; @@ -927,7 +927,8 @@ EXPORT_SYMBOL_GPL(bind_interdomain_evtchn_to_irq); static int find_virq(unsigned int virq, unsigned int cpu) { struct evtchn_status status; - int port, rc =3D -ENOENT; + evtchn_port_t port; + int rc =3D -ENOENT; =20 memset(&status, 0, sizeof(status)); for (port =3D 0; port < xen_evtchn_max_channels(); port++) { @@ -962,7 +963,8 @@ EXPORT_SYMBOL_GPL(xen_evtchn_nr_channels); int bind_virq_to_irq(unsigned int virq, unsigned int cpu, bool percpu) { struct evtchn_bind_virq bind_virq; - int evtchn, irq, ret; + evtchn_port_t evtchn =3D xen_evtchn_max_channels(); + int irq, ret; =20 mutex_lock(&irq_mapping_update_lock); =20 @@ -990,7 +992,6 @@ int bind_virq_to_irq(unsigned int virq, unsigned int cp= u, bool percpu) if (ret =3D=3D -EEXIST) ret =3D find_virq(virq, cpu); BUG_ON(ret < 0); - evtchn =3D ret; } =20 ret =3D xen_irq_info_virq_setup(cpu, irq, evtchn, virq); @@ -1019,7 +1020,7 @@ static void unbind_from_irq(unsigned int irq) mutex_unlock(&irq_mapping_update_lock); } =20 -int bind_evtchn_to_irqhandler(unsigned int evtchn, +int bind_evtchn_to_irqhandler(evtchn_port_t evtchn, irq_handler_t handler, unsigned long irqflags, const char *devname, void *dev_id) @@ -1040,7 +1041,7 @@ int bind_evtchn_to_irqhandler(unsigned int evtchn, EXPORT_SYMBOL_GPL(bind_evtchn_to_irqhandler); =20 int bind_interdomain_evtchn_to_irqhandler(unsigned int remote_domain, - unsigned int remote_port, + evtchn_port_t remote_port, irq_handler_t handler, unsigned long irqflags, const char *devname, @@ -1132,7 +1133,7 @@ int xen_set_irq_priority(unsigned irq, unsigned prior= ity) } EXPORT_SYMBOL_GPL(xen_set_irq_priority); =20 -int evtchn_make_refcounted(unsigned int evtchn) +int evtchn_make_refcounted(evtchn_port_t evtchn) { int irq =3D get_evtchn_to_irq(evtchn); struct irq_info *info; @@ -1153,7 +1154,7 @@ int evtchn_make_refcounted(unsigned int evtchn) } EXPORT_SYMBOL_GPL(evtchn_make_refcounted); =20 -int evtchn_get(unsigned int evtchn) +int evtchn_get(evtchn_port_t evtchn) { int irq; struct irq_info *info; @@ -1186,7 +1187,7 @@ int evtchn_get(unsigned int evtchn) } EXPORT_SYMBOL_GPL(evtchn_get); =20 -void evtchn_put(unsigned int evtchn) +void evtchn_put(evtchn_port_t evtchn) { int irq =3D get_evtchn_to_irq(evtchn); if (WARN_ON(irq =3D=3D -1)) @@ -1252,7 +1253,7 @@ void xen_hvm_evtchn_do_upcall(void) EXPORT_SYMBOL_GPL(xen_hvm_evtchn_do_upcall); =20 /* Rebind a new event channel to an existing irq. */ -void rebind_evtchn_irq(int evtchn, int irq) +void rebind_evtchn_irq(evtchn_port_t evtchn, int irq) { struct irq_info *info =3D info_for_irq(irq); =20 @@ -1275,7 +1276,7 @@ void rebind_evtchn_irq(int evtchn, int irq) =20 mutex_unlock(&irq_mapping_update_lock); =20 - bind_evtchn_to_cpu(evtchn, info->cpu); + bind_evtchn_to_cpu(evtchn, info->cpu); /* This will be deferred until interrupt is processed */ irq_set_affinity(irq, cpumask_of(info->cpu)); =20 @@ -1284,7 +1285,7 @@ void rebind_evtchn_irq(int evtchn, int irq) } =20 /* Rebind an evtchn so that it gets delivered to a specific cpu */ -static int xen_rebind_evtchn_to_cpu(int evtchn, unsigned int tcpu) +static int xen_rebind_evtchn_to_cpu(evtchn_port_t evtchn, unsigned int tcp= u) { struct evtchn_bind_vcpu bind_vcpu; int masked; @@ -1342,7 +1343,7 @@ EXPORT_SYMBOL_GPL(xen_set_affinity_evtchn); =20 static void enable_dynirq(struct irq_data *data) { - int evtchn =3D evtchn_from_irq(data->irq); + evtchn_port_t evtchn =3D evtchn_from_irq(data->irq); =20 if (VALID_EVTCHN(evtchn)) unmask_evtchn(evtchn); @@ -1350,7 +1351,7 @@ static void enable_dynirq(struct irq_data *data) =20 static void disable_dynirq(struct irq_data *data) { - int evtchn =3D evtchn_from_irq(data->irq); + evtchn_port_t evtchn =3D evtchn_from_irq(data->irq); =20 if (VALID_EVTCHN(evtchn)) mask_evtchn(evtchn); @@ -1358,7 +1359,7 @@ static void disable_dynirq(struct irq_data *data) =20 static void ack_dynirq(struct irq_data *data) { - int evtchn =3D evtchn_from_irq(data->irq); + evtchn_port_t evtchn =3D evtchn_from_irq(data->irq); =20 if (!VALID_EVTCHN(evtchn)) return; @@ -1385,7 +1386,7 @@ static void mask_ack_dynirq(struct irq_data *data) =20 static int retrigger_dynirq(struct irq_data *data) { - unsigned int evtchn =3D evtchn_from_irq(data->irq); + evtchn_port_t evtchn =3D evtchn_from_irq(data->irq); int masked; =20 if (!VALID_EVTCHN(evtchn)) @@ -1440,7 +1441,8 @@ static void restore_pirqs(void) static void restore_cpu_virqs(unsigned int cpu) { struct evtchn_bind_virq bind_virq; - int virq, irq, evtchn; + evtchn_port_t evtchn; + int virq, irq; =20 for (virq =3D 0; virq < NR_VIRQS; virq++) { if ((irq =3D per_cpu(virq_to_irq, cpu)[virq]) =3D=3D -1) @@ -1465,7 +1467,8 @@ static void restore_cpu_virqs(unsigned int cpu) static void restore_cpu_ipis(unsigned int cpu) { struct evtchn_bind_ipi bind_ipi; - int ipi, irq, evtchn; + evtchn_port_t evtchn; + int ipi, irq; =20 for (ipi =3D 0; ipi < XEN_NR_IPIS; ipi++) { if ((irq =3D per_cpu(ipi_to_irq, cpu)[ipi]) =3D=3D -1) @@ -1489,7 +1492,7 @@ static void restore_cpu_ipis(unsigned int cpu) /* Clear an irq's pending state, in preparation for polling on it */ void xen_clear_irq_pending(int irq) { - int evtchn =3D evtchn_from_irq(irq); + evtchn_port_t evtchn =3D evtchn_from_irq(irq); =20 if (VALID_EVTCHN(evtchn)) clear_evtchn(evtchn); @@ -1497,7 +1500,7 @@ void xen_clear_irq_pending(int irq) EXPORT_SYMBOL(xen_clear_irq_pending); void xen_set_irq_pending(int irq) { - int evtchn =3D evtchn_from_irq(irq); + evtchn_port_t evtchn =3D evtchn_from_irq(irq); =20 if (VALID_EVTCHN(evtchn)) set_evtchn(evtchn); @@ -1505,7 +1508,7 @@ void xen_set_irq_pending(int irq) =20 bool xen_test_irq_pending(int irq) { - int evtchn =3D evtchn_from_irq(irq); + evtchn_port_t evtchn =3D evtchn_from_irq(irq); bool ret =3D false; =20 if (VALID_EVTCHN(evtchn)) @@ -1667,7 +1670,7 @@ module_param(fifo_events, bool, 0); void __init xen_init_IRQ(void) { int ret =3D -EINVAL; - unsigned int evtchn; + evtchn_port_t evtchn; =20 if (fifo_events) ret =3D xen_evtchn_fifo_init(); diff --git a/drivers/xen/events/events_fifo.c b/drivers/xen/events/events_f= ifo.c index 76b318e88382..c60ee0450173 100644 --- a/drivers/xen/events/events_fifo.c +++ b/drivers/xen/events/events_fifo.c @@ -82,7 +82,7 @@ static unsigned event_array_pages __read_mostly; =20 #endif =20 -static inline event_word_t *event_word_from_port(unsigned port) +static inline event_word_t *event_word_from_port(evtchn_port_t port) { unsigned i =3D port / EVENT_WORDS_PER_PAGE; =20 @@ -140,7 +140,7 @@ static void init_array_page(event_word_t *array_page) =20 static int evtchn_fifo_setup(struct irq_info *info) { - unsigned port =3D info->evtchn; + evtchn_port_t port =3D info->evtchn; unsigned new_array_pages; int ret; =20 @@ -191,37 +191,37 @@ static void evtchn_fifo_bind_to_cpu(struct irq_info *= info, unsigned cpu) /* no-op */ } =20 -static void evtchn_fifo_clear_pending(unsigned port) +static void evtchn_fifo_clear_pending(evtchn_port_t port) { event_word_t *word =3D event_word_from_port(port); sync_clear_bit(EVTCHN_FIFO_BIT(PENDING, word), BM(word)); } =20 -static void evtchn_fifo_set_pending(unsigned port) +static void evtchn_fifo_set_pending(evtchn_port_t port) { event_word_t *word =3D event_word_from_port(port); sync_set_bit(EVTCHN_FIFO_BIT(PENDING, word), BM(word)); } =20 -static bool evtchn_fifo_is_pending(unsigned port) +static bool evtchn_fifo_is_pending(evtchn_port_t port) { event_word_t *word =3D event_word_from_port(port); return sync_test_bit(EVTCHN_FIFO_BIT(PENDING, word), BM(word)); } =20 -static bool evtchn_fifo_test_and_set_mask(unsigned port) +static bool evtchn_fifo_test_and_set_mask(evtchn_port_t port) { event_word_t *word =3D event_word_from_port(port); return sync_test_and_set_bit(EVTCHN_FIFO_BIT(MASKED, word), BM(word)); } =20 -static void evtchn_fifo_mask(unsigned port) +static void evtchn_fifo_mask(evtchn_port_t port) { event_word_t *word =3D event_word_from_port(port); sync_set_bit(EVTCHN_FIFO_BIT(MASKED, word), BM(word)); } =20 -static bool evtchn_fifo_is_masked(unsigned port) +static bool evtchn_fifo_is_masked(evtchn_port_t port) { event_word_t *word =3D event_word_from_port(port); return sync_test_bit(EVTCHN_FIFO_BIT(MASKED, word), BM(word)); @@ -242,7 +242,7 @@ static void clear_masked(volatile event_word_t *word) } while (w !=3D old); } =20 -static void evtchn_fifo_unmask(unsigned port) +static void evtchn_fifo_unmask(evtchn_port_t port) { event_word_t *word =3D event_word_from_port(port); =20 @@ -270,7 +270,7 @@ static uint32_t clear_linked(volatile event_word_t *wor= d) return w & EVTCHN_FIFO_LINK_MASK; } =20 -static void handle_irq_for_port(unsigned port) +static void handle_irq_for_port(evtchn_port_t port) { int irq; =20 @@ -286,7 +286,7 @@ static void consume_one_event(unsigned cpu, { struct evtchn_fifo_queue *q =3D &per_cpu(cpu_queue, cpu); uint32_t head; - unsigned port; + evtchn_port_t port; event_word_t *word; =20 head =3D q->head[priority]; diff --git a/drivers/xen/events/events_internal.h b/drivers/xen/events/even= ts_internal.h index 82938cff6c7a..10684feb094e 100644 --- a/drivers/xen/events/events_internal.h +++ b/drivers/xen/events/events_internal.h @@ -33,7 +33,7 @@ struct irq_info { int refcnt; enum xen_irq_type type; /* type */ unsigned irq; - unsigned int evtchn; /* event channel */ + evtchn_port_t evtchn; /* event channel */ unsigned short cpu; /* cpu bound */ =20 union { @@ -60,12 +60,12 @@ struct evtchn_ops { int (*setup)(struct irq_info *info); void (*bind_to_cpu)(struct irq_info *info, unsigned cpu); =20 - void (*clear_pending)(unsigned port); - void (*set_pending)(unsigned port); - bool (*is_pending)(unsigned port); - bool (*test_and_set_mask)(unsigned port); - void (*mask)(unsigned port); - void (*unmask)(unsigned port); + void (*clear_pending)(evtchn_port_t port); + void (*set_pending)(evtchn_port_t port); + bool (*is_pending)(evtchn_port_t port); + bool (*test_and_set_mask)(evtchn_port_t port); + void (*mask)(evtchn_port_t port); + void (*unmask)(evtchn_port_t port); =20 void (*handle_events)(unsigned cpu); void (*resume)(void); @@ -74,11 +74,11 @@ struct evtchn_ops { extern const struct evtchn_ops *evtchn_ops; =20 extern int **evtchn_to_irq; -int get_evtchn_to_irq(unsigned int evtchn); +int get_evtchn_to_irq(evtchn_port_t evtchn); =20 struct irq_info *info_for_irq(unsigned irq); unsigned cpu_from_irq(unsigned irq); -unsigned cpu_from_evtchn(unsigned int evtchn); +unsigned int cpu_from_evtchn(evtchn_port_t evtchn); =20 static inline unsigned xen_evtchn_max_channels(void) { @@ -102,32 +102,32 @@ static inline void xen_evtchn_port_bind_to_cpu(struct= irq_info *info, evtchn_ops->bind_to_cpu(info, cpu); } =20 -static inline void clear_evtchn(unsigned port) +static inline void clear_evtchn(evtchn_port_t port) { evtchn_ops->clear_pending(port); } =20 -static inline void set_evtchn(unsigned port) +static inline void set_evtchn(evtchn_port_t port) { evtchn_ops->set_pending(port); } =20 -static inline bool test_evtchn(unsigned port) +static inline bool test_evtchn(evtchn_port_t port) { return evtchn_ops->is_pending(port); } =20 -static inline bool test_and_set_mask(unsigned port) +static inline bool test_and_set_mask(evtchn_port_t port) { return evtchn_ops->test_and_set_mask(port); } =20 -static inline void mask_evtchn(unsigned port) +static inline void mask_evtchn(evtchn_port_t port) { return evtchn_ops->mask(port); } =20 -static inline void unmask_evtchn(unsigned port) +static inline void unmask_evtchn(evtchn_port_t port) { return evtchn_ops->unmask(port); } diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c index 052b55a14ebc..6e0b1dd5573c 100644 --- a/drivers/xen/evtchn.c +++ b/drivers/xen/evtchn.c @@ -83,7 +83,7 @@ struct per_user_data { struct user_evtchn { struct rb_node node; struct per_user_data *user; - unsigned port; + evtchn_port_t port; bool enabled; }; =20 @@ -138,7 +138,8 @@ static void del_evtchn(struct per_user_data *u, struct = user_evtchn *evtchn) kfree(evtchn); } =20 -static struct user_evtchn *find_evtchn(struct per_user_data *u, unsigned p= ort) +static struct user_evtchn *find_evtchn(struct per_user_data *u, + evtchn_port_t port) { struct rb_node *node =3D u->evtchns.rb_node; =20 @@ -163,7 +164,7 @@ static irqreturn_t evtchn_interrupt(int irq, void *data) struct per_user_data *u =3D evtchn->user; =20 WARN(!evtchn->enabled, - "Interrupt for port %d, but apparently not enabled; per-user %p\n", + "Interrupt for port %u, but apparently not enabled; per-user %p\n", evtchn->port, u); =20 disable_irq_nosync(irq); @@ -286,7 +287,7 @@ static ssize_t evtchn_write(struct file *file, const ch= ar __user *buf, mutex_lock(&u->bind_mutex); =20 for (i =3D 0; i < (count/sizeof(evtchn_port_t)); i++) { - unsigned port =3D kbuf[i]; + evtchn_port_t port =3D kbuf[i]; struct user_evtchn *evtchn; =20 evtchn =3D find_evtchn(u, port); @@ -361,7 +362,7 @@ static int evtchn_resize_ring(struct per_user_data *u) return 0; } =20 -static int evtchn_bind_to_user(struct per_user_data *u, int port) +static int evtchn_bind_to_user(struct per_user_data *u, evtchn_port_t port) { struct user_evtchn *evtchn; struct evtchn_close close; @@ -423,7 +424,7 @@ static void evtchn_unbind_from_user(struct per_user_dat= a *u, =20 static DEFINE_PER_CPU(int, bind_last_selected_cpu); =20 -static void evtchn_bind_interdom_next_vcpu(int evtchn) +static void evtchn_bind_interdom_next_vcpu(evtchn_port_t evtchn) { unsigned int selected_cpu, irq; struct irq_desc *desc; diff --git a/drivers/xen/pvcalls-back.c b/drivers/xen/pvcalls-back.c index c57c71b7d53d..cf4ce3e9358d 100644 --- a/drivers/xen/pvcalls-back.c +++ b/drivers/xen/pvcalls-back.c @@ -300,7 +300,7 @@ static struct sock_mapping *pvcalls_new_active_socket( struct pvcalls_fedata *fedata, uint64_t id, grant_ref_t ref, - uint32_t evtchn, + evtchn_port_t evtchn, struct socket *sock) { int ret; @@ -905,7 +905,8 @@ static irqreturn_t pvcalls_back_conn_event(int irq, voi= d *sock_map) =20 static int backend_connect(struct xenbus_device *dev) { - int err, evtchn; + int err; + evtchn_port_t evtchn; grant_ref_t ring_ref; struct pvcalls_fedata *fedata =3D NULL; =20 diff --git a/drivers/xen/xen-pciback/xenbus.c b/drivers/xen/xen-pciback/xen= bus.c index 833b2d2c4318..f2115587855f 100644 --- a/drivers/xen/xen-pciback/xenbus.c +++ b/drivers/xen/xen-pciback/xenbus.c @@ -105,13 +105,13 @@ static void free_pdev(struct xen_pcibk_device *pdev) } =20 static int xen_pcibk_do_attach(struct xen_pcibk_device *pdev, int gnt_ref, - int remote_evtchn) + evtchn_port_t remote_evtchn) { int err =3D 0; void *vaddr; =20 dev_dbg(&pdev->xdev->dev, - "Attaching to frontend resources - gnt_ref=3D%d evtchn=3D%d\n", + "Attaching to frontend resources - gnt_ref=3D%d evtchn=3D%u\n", gnt_ref, remote_evtchn); =20 err =3D xenbus_map_ring_valloc(pdev->xdev, &gnt_ref, 1, &vaddr); @@ -142,7 +142,8 @@ static int xen_pcibk_do_attach(struct xen_pcibk_device = *pdev, int gnt_ref, static int xen_pcibk_attach(struct xen_pcibk_device *pdev) { int err =3D 0; - int gnt_ref, remote_evtchn; + int gnt_ref; + evtchn_port_t remote_evtchn; char *magic =3D NULL; =20 =20 diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c index ba0942e481bc..75c0a2e9a6db 100644 --- a/drivers/xen/xen-scsiback.c +++ b/drivers/xen/xen-scsiback.c @@ -854,7 +854,8 @@ static int scsiback_init_sring(struct vscsibk_info *inf= o, grant_ref_t ring_ref, static int scsiback_map(struct vscsibk_info *info) { struct xenbus_device *dev =3D info->dev; - unsigned int ring_ref, evtchn; + unsigned int ring_ref; + evtchn_port_t evtchn; int err; =20 err =3D xenbus_gather(XBT_NIL, dev->otherend, diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus= _client.c index e17ca8156171..1f87514e4efc 100644 --- a/drivers/xen/xenbus/xenbus_client.c +++ b/drivers/xen/xenbus/xenbus_client.c @@ -391,7 +391,7 @@ EXPORT_SYMBOL_GPL(xenbus_grant_ring); * error, the device will switch to XenbusStateClosing, and the error will= be * saved in the store. */ -int xenbus_alloc_evtchn(struct xenbus_device *dev, int *port) +int xenbus_alloc_evtchn(struct xenbus_device *dev, evtchn_port_t *port) { struct evtchn_alloc_unbound alloc_unbound; int err; @@ -414,7 +414,7 @@ EXPORT_SYMBOL_GPL(xenbus_alloc_evtchn); /** * Free an existing event channel. Returns 0 on success or -errno on error. */ -int xenbus_free_evtchn(struct xenbus_device *dev, int port) +int xenbus_free_evtchn(struct xenbus_device *dev, evtchn_port_t port) { struct evtchn_close close; int err; @@ -423,7 +423,7 @@ int xenbus_free_evtchn(struct xenbus_device *dev, int p= ort) =20 err =3D HYPERVISOR_event_channel_op(EVTCHNOP_close, &close); if (err) - xenbus_dev_error(dev, err, "freeing event channel %d", port); + xenbus_dev_error(dev, err, "freeing event channel %u", port); =20 return err; } diff --git a/include/xen/events.h b/include/xen/events.h index c0e6a0598397..7fe5a73b8bda 100644 --- a/include/xen/events.h +++ b/include/xen/events.h @@ -14,8 +14,8 @@ =20 unsigned xen_evtchn_nr_channels(void); =20 -int bind_evtchn_to_irq(unsigned int evtchn); -int bind_evtchn_to_irqhandler(unsigned int evtchn, +int bind_evtchn_to_irq(evtchn_port_t evtchn); +int bind_evtchn_to_irqhandler(evtchn_port_t evtchn, irq_handler_t handler, unsigned long irqflags, const char *devname, void *dev_id); @@ -31,9 +31,9 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi, const char *devname, void *dev_id); int bind_interdomain_evtchn_to_irq(unsigned int remote_domain, - unsigned int remote_port); + evtchn_port_t remote_port); int bind_interdomain_evtchn_to_irqhandler(unsigned int remote_domain, - unsigned int remote_port, + evtchn_port_t remote_port, irq_handler_t handler, unsigned long irqflags, const char *devname, @@ -54,15 +54,15 @@ int xen_set_irq_priority(unsigned irq, unsigned priorit= y); /* * Allow extra references to event channels exposed to userspace by evtchn */ -int evtchn_make_refcounted(unsigned int evtchn); -int evtchn_get(unsigned int evtchn); -void evtchn_put(unsigned int evtchn); +int evtchn_make_refcounted(evtchn_port_t evtchn); +int evtchn_get(evtchn_port_t evtchn); +void evtchn_put(evtchn_port_t evtchn); =20 void xen_send_IPI_one(unsigned int cpu, enum ipi_vector vector); -void rebind_evtchn_irq(int evtchn, int irq); +void rebind_evtchn_irq(evtchn_port_t evtchn, int irq); int xen_set_affinity_evtchn(struct irq_desc *desc, unsigned int tcpu); =20 -static inline void notify_remote_via_evtchn(int port) +static inline void notify_remote_via_evtchn(evtchn_port_t port) { struct evtchn_send send =3D { .port =3D port }; (void)HYPERVISOR_event_channel_op(EVTCHNOP_send, &send); @@ -86,7 +86,7 @@ void xen_poll_irq(int irq); void xen_poll_irq_timeout(int irq, u64 timeout); =20 /* Determine the IRQ which is bound to an event channel */ -unsigned irq_from_evtchn(unsigned int evtchn); +unsigned int irq_from_evtchn(evtchn_port_t evtchn); int irq_from_virq(unsigned int cpu, unsigned int virq); unsigned int evtchn_from_irq(unsigned irq); =20 diff --git a/include/xen/interface/event_channel.h b/include/xen/interface/= event_channel.h index 45650c9a06d5..cf80e338fbb0 100644 --- a/include/xen/interface/event_channel.h +++ b/include/xen/interface/event_channel.h @@ -220,7 +220,7 @@ struct evtchn_expand_array { #define EVTCHNOP_set_priority 13 struct evtchn_set_priority { /* IN parameters. */ - uint32_t port; + evtchn_port_t port; uint32_t priority; }; =20 diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h index 89a889585ba0..4f35216064ba 100644 --- a/include/xen/xenbus.h +++ b/include/xen/xenbus.h @@ -218,8 +218,8 @@ int xenbus_unmap_ring(struct xenbus_device *dev, grant_handle_t *handles, unsigned int nr_handles, unsigned long *vaddrs); =20 -int xenbus_alloc_evtchn(struct xenbus_device *dev, int *port); -int xenbus_free_evtchn(struct xenbus_device *dev, int port); +int xenbus_alloc_evtchn(struct xenbus_device *dev, unsigned int *port); +int xenbus_free_evtchn(struct xenbus_device *dev, unsigned int port); =20 enum xenbus_state xenbus_read_driver_state(const char *path); =20 --=20 2.17.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel