From nobody Sun May 5 12:16:38 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.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 (zoho.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=1561027242; cv=none; d=zoho.com; s=zohoarc; b=neiIjefLYw4bMo7BayIFo80lPmTqNy6UNQWfdgoL9YGG2e2/5fkTPP81f3psGLyjZyrLIqyqzJOUqilGENaxtRQjTksWJIpI9eAMz6zFY2yK/ka4oH640xCJ3dIQ8+DZI+0CY/jocMNWyQpAFQNZeVX5OrtAhJrZybCY0R1kjDE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561027242; 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:ARC-Authentication-Results; bh=buMue7+dMqTPkPjNXMo23uqU5UThBC6iHfLUiJRgEnQ=; b=Zn5fazi5/yVGpe9QNAbtL2FFJ3tq3nziOQwDXw4Kt/6PHJnxcZqokL+4PEEGev4GJfEmIF6AS89WY7aKl1zF9VhgMTVBSC6BPmR+6tmwX8N14+tBF5pNb5JBfYRQRBI2xuhgtQX6GZAi/8eWoMHbnLWjio204FgFjWjh6btT1gY= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.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 1561027242194942.4456756755621; Thu, 20 Jun 2019 03:40:42 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hduT9-0007Ci-AS; Thu, 20 Jun 2019 10:39:03 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hduT8-0007Cd-Bd for xen-devel@lists.xenproject.org; Thu, 20 Jun 2019 10:39:02 +0000 Received: from mail-lj1-x241.google.com (unknown [2a00:1450:4864:20::241]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 9cee8d98-9347-11e9-8980-bc764e045a96; Thu, 20 Jun 2019 10:39:00 +0000 (UTC) Received: by mail-lj1-x241.google.com with SMTP id t28so2196763lje.9 for ; Thu, 20 Jun 2019 03:39:00 -0700 (PDT) Received: from 3489.kyiv.epam.com (ll-22.209.223.85.sovam.net.ua. [85.223.209.22]) by smtp.gmail.com with ESMTPSA id p76sm2972146ljb.49.2019.06.20.03.38.57 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 20 Jun 2019 03:38:58 -0700 (PDT) X-Inumbo-ID: 9cee8d98-9347-11e9-8980-bc764e045a96 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=dIpauCHE8WQzh1Qq4JMUKfeLX+wuwYQBbOmknMiYfG0=; b=jedBYIQBINZwLLJix89Np7pxKSFTslPRn4tOXp9SBH5C88CuDxxYA3D1dsdvM9nm51 JOlbog1MdN8/23zy2GdC/XgrQLQTOTJCDUm8i90720M9Ahuk0sDloXSdF33pw+PW9CoN MR8W8Ql67zkvlND5JEnoCriQhGc7Aw+KBg58/3+4I91t5/jRq4beVuGAaUPzwogo6OeI 7cNe6w4cEXPtPd3WfsVUGa3rn7ClxYQrrogzzabd/bmmNIQ1xOY9ctxrvWapLKiAOfMW Wt+f4WQvuHsZaQ5VP8oF88ftYYUjtEwwDEN3m2WTaZ98lmowOb9+5ku6++zL2m4XsZs5 RKlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=dIpauCHE8WQzh1Qq4JMUKfeLX+wuwYQBbOmknMiYfG0=; b=a9jVkxctmKAIRpZhIdDmpBjnOWE/Xa8HGR99Nwx63TP98fNXSuTZaNWwoF9sGCrqdX p+S32F9eEwRwGf1s1uskAluR2+51ojSR+eXiY4zbY+TsCW0MCV6+RnyIbCc4jWnJm8p1 WA7HvX/8NCUWlqZrXgZ7gQbIyA3iUIik2TiwHqeqsrnOdIgo8KmBad+aFzOKFq3MyyYn fgUrnL7s+A5nE/7ZUJFOtR25+waOrKcK640H3UOrQscSr+JsYLJcIn1kGd23/4Er47vu h6DCujHUrsSsXSxO2bWwq6zTmsbd0w/HazX9P5oq7DCVxqMmhodLeLYyc/tJnD/0Srvc 8gUA== X-Gm-Message-State: APjAAAVTSgtnepAC0ifBqFD7OucH0R12PqVYoNUSeMqqcG8qF5oOv5Xn fCI3g1Yks2TP6CEF0FGwVo8BmaHl X-Google-Smtp-Source: APXvYqyQL+igFFWDsJdlx5itCEG93jz8II9xQkc6xVkdWC3YNz682gJR8wLhw6Vihqew/MCHhUg3Lg== X-Received: by 2002:a2e:6c0f:: with SMTP id h15mr5630750ljc.36.1561027138774; Thu, 20 Jun 2019 03:38:58 -0700 (PDT) From: Viktor Mitin To: xen-devel@lists.xenproject.org Date: Thu, 20 Jun 2019 13:38:05 +0300 Message-Id: <20190620103805.927-1-viktor.mitin.19@gmail.com> X-Mailer: git-send-email 2.17.1 Subject: [Xen-devel] [PATCH] xen/arm: merge make_timer_node and make_timer_domU_node 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: julien.grall@arm.com, sstabellini@kernel.org, Viktor Mitin , Viktor Mitin MIME-Version: 1.0 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) Functions make_timer_node and make_timer_domU_node are quite similar. The only difference between Dom0 and DomU timer DT node is the timer interrupts used. All the rest code should be the same. So it is better to merge them to avoid discrepancy. Tested dom0 boot with rcar h3 sk board. Suggested-by: Julien Grall Signed-off-by: Viktor Mitin --- xen/arch/arm/domain_build.c | 66 ++++++++++++------------------------- 1 file changed, 21 insertions(+), 45 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 7fb828cae2..610dd3e8e7 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -976,6 +976,8 @@ static int __init make_timer_node(const struct domain *= d, void *fdt) gic_interrupt_t intrs[3]; u32 clock_frequency; bool clock_valid; + bool d0 =3D is_hardware_domain(d); + uint32_t ip_val; =20 dt_dprintk("Create timer node\n"); =20 @@ -1004,22 +1006,36 @@ static int __init make_timer_node(const struct doma= in *d, void *fdt) /* The timer IRQ is emulated by Xen. It always exposes an active-low * level-sensitive interrupt */ =20 - irq =3D timer_get_irq(TIMER_PHYS_SECURE_PPI); + irq =3D d0 + ? timer_get_irq(TIMER_PHYS_SECURE_PPI) + : GUEST_TIMER_PHYS_S_PPI; dt_dprintk(" Secure interrupt %u\n", irq); set_interrupt(intrs[0], irq, 0xf, DT_IRQ_TYPE_LEVEL_LOW); =20 - irq =3D timer_get_irq(TIMER_PHYS_NONSECURE_PPI); + irq =3D d0 + ? timer_get_irq(TIMER_PHYS_NONSECURE_PPI) + : GUEST_TIMER_PHYS_NS_PPI; dt_dprintk(" Non secure interrupt %u\n", irq); set_interrupt(intrs[1], irq, 0xf, DT_IRQ_TYPE_LEVEL_LOW); =20 - irq =3D timer_get_irq(TIMER_VIRT_PPI); + irq =3D d0 + ? timer_get_irq(TIMER_VIRT_PPI) + : GUEST_TIMER_VIRT_PPI; dt_dprintk(" Virt interrupt %u\n", irq); set_interrupt(intrs[2], irq, 0xf, DT_IRQ_TYPE_LEVEL_LOW); =20 - res =3D fdt_property_interrupts(fdt, intrs, 3); + res =3D fdt_property(fdt, "interrupts", intrs, sizeof (intrs[0]) * 3); if ( res ) return res; =20 + ip_val =3D d0 + ? dt_interrupt_controller->phandle + : GUEST_PHANDLE_GIC; + + res =3D fdt_property_cell(fdt, "interrupt-parent", ip_val); + if (res) + return res; + clock_valid =3D dt_property_read_u32(dev, "clock-frequency", &clock_frequency); if ( clock_valid ) @@ -1581,46 +1597,6 @@ static int __init make_gic_domU_node(const struct do= main *d, void *fdt) } } =20 -static int __init make_timer_domU_node(const struct domain *d, void *fdt) -{ - int res; - gic_interrupt_t intrs[3]; - - res =3D fdt_begin_node(fdt, "timer"); - if ( res ) - return res; - - if ( !is_64bit_domain(d) ) - { - res =3D fdt_property_string(fdt, "compatible", "arm,armv7-timer"); - if ( res ) - return res; - } - else - { - res =3D fdt_property_string(fdt, "compatible", "arm,armv8-timer"); - if ( res ) - return res; - } - - set_interrupt(intrs[0], GUEST_TIMER_PHYS_S_PPI, 0xf, DT_IRQ_TYPE_LEVEL= _LOW); - set_interrupt(intrs[1], GUEST_TIMER_PHYS_NS_PPI, 0xf, DT_IRQ_TYPE_LEVE= L_LOW); - set_interrupt(intrs[2], GUEST_TIMER_VIRT_PPI, 0xf, DT_IRQ_TYPE_LEVEL_L= OW); - - res =3D fdt_property(fdt, "interrupts", intrs, sizeof (intrs[0]) * 3); - if ( res ) - return res; - - res =3D fdt_property_cell(fdt, "interrupt-parent", - GUEST_PHANDLE_GIC); - if (res) - return res; - - res =3D fdt_end_node(fdt); - - return res; -} - #ifdef CONFIG_SBSA_VUART_CONSOLE static int __init make_vpl011_uart_node(const struct domain *d, void *fdt) { @@ -1726,7 +1702,7 @@ static int __init prepare_dtb_domU(struct domain *d, = struct kernel_info *kinfo) if ( ret ) goto err; =20 - ret =3D make_timer_domU_node(d, kinfo->fdt); + ret =3D make_timer_node(d, kinfo->fdt); if ( ret ) goto err; =20 --=20 2.17.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel