From nobody Fri Nov 22 19:33:24 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=1716548975; cv=none; d=zohomail.com; s=zohoarc; b=aPFy7Pmqowy15AD7PaBkqlCERUNF3oMp9iEQR8GPPMT8eoFj0cJbie1a/ytp5OJh7nXPW1UQk8IF9w1Jj/xDz8E7bul5kbN2aPlXBxMyNmDR54imSjX3428CES1zKcyePS7+g8PPC+r0Er0j6ymbFTUKmk2eRFOz0fKT4lvKSIA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716548975; 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=b94wI6kNLTmJ8tMNKvMfG5/MPujiYvHPiuL4CtLKoSc=; b=lh0BNkYPg6LVx6J7rjHEhiKeRsQlkqFl+naye6tMfSUyw36cRj26JDCcASDEHV9XK5antf4jtQ7tT4mEKSr7St7wByTiIveKlMIXHi91k4RrDnqNSyeck2BJu+fKZhdLokGN85mKExSM3DemkvpbttrvUj0GYRJF+KjOqi9njv8= 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 1716548975804762.4624775782144; Fri, 24 May 2024 04:09:35 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.729364.1134571 (Exim 4.92) (envelope-from ) id 1sASnP-0005FR-3a; Fri, 24 May 2024 11:09:11 +0000 Received: by outflank-mailman (output) from mailman id 729364.1134571; Fri, 24 May 2024 11:09:10 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sASnO-0005CV-N3; Fri, 24 May 2024 11:09:10 +0000 Received: by outflank-mailman (input) for mailman id 729364; Fri, 24 May 2024 11:09:09 +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 1sASnN-0003Cz-Bt for xen-devel@lists.xenproject.org; Fri, 24 May 2024 11:09:09 +0000 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [2a00:1450:4864:20::135]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 09aac8da-19be-11ef-b4bb-af5377834399; Fri, 24 May 2024 13:09:06 +0200 (CEST) Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-529614b8c29so1080110e87.2 for ; Fri, 24 May 2024 04:09:06 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626c817c81sm116051366b.28.2024.05.24.04.09.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 04:09:05 -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: 09aac8da-19be-11ef-b4bb-af5377834399 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716548946; x=1717153746; 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=b94wI6kNLTmJ8tMNKvMfG5/MPujiYvHPiuL4CtLKoSc=; b=TGApL4xbpj1bi+C+A/R1tnjLrosORRiReivdaxuhQOpKsnNvCNJ+0seR7+K0OZpTlo sUo+XqjON0yg0Xr5KPiOj5+KCToKwH4dvXM5AS4D/Eml9gfVI67C1ignHcYCfTfW8V4d sKgxw8BEyaQFuBYwBQpjfynBvC7MiK5rrFdHSzFJRCt3EpxSJXh688seRzHWcrwBJ5iU vCa2xMa87+iHMeNVjZVBq7v3YFM0HL8Pu2pILBHqTBbKISXCt50nfiRmYyz/umwAFU6e a6MtJ9GSnkVeF4r31tMNiuPakaoQnXKgVQGN8gTbXiFIT9PZXy7GXX+VrgNN6q1D9TYm Hc3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716548946; x=1717153746; 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=b94wI6kNLTmJ8tMNKvMfG5/MPujiYvHPiuL4CtLKoSc=; b=R5bDn17ycChOAUX2Nq4Qbjw2NAsVDpwpSy1nsdC9x839okL7JPI8SnGdwKTKtc+wlG p4zoZjC9CxoxUn9Ty7bpF5yDuBPtij2O5qlg/bI6UT+rn02XfYJe57ZMxTp9hfnF+5A5 6dWRc4bkRPAnCOTvINZK6GPhmCwLixdMDX8aJBbdz6MAc07+PsEGdSy49sOiiS8ubA7H JfzbT1B37Wkm96dYrEwoFtoGsSscdsGMZyaDEu87yyXoix/OfFRCYQPPMw4nZuuwdg3q NbCKtLEFD3t79+F3zNDvU2j4pVBILfe8Dtok0kQsQu1V7FdqXtinTabRXndwuEdp2ofz aSBQ== X-Gm-Message-State: AOJu0YzATpinc9dqHr10zXU+MqqBlK8oQc9+fBM1rR1sluWGb1VA4RVk nF7TR39MxXvsHbaZFAwGRpzgw89eiBArDZfQNFoObPCiVImfU4PdRhH58tLS X-Google-Smtp-Source: AGHT+IGTH7Y8u4ycvlLBGeDfRcjwpph4JM2NgKLV/prJHx2KwU7K2TBeDUfL+BiJjbWFST7ABLYYbA== X-Received: by 2002:ac2:4c49:0:b0:51d:8842:f0b8 with SMTP id 2adb3069b0e04-5296529053bmr2240082e87.13.1716548946203; Fri, 24 May 2024 04:09:06 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Alistair Francis , Bob Eshleman , Connor Davis , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini Subject: [PATCH v11 8/9] xen/riscv: enable full Xen build Date: Fri, 24 May 2024 13:08:54 +0200 Message-ID: <0a684923efb23fb6094aeab680022b6b14196eef.1716547693.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1716548977389100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Oleksii Kurochko Reviewed-by: Jan Beulich --- At least this patch cann't be merged w/o Andrew's patch series is merged a= s ffs related functions are used from that patch series: https://lore.kernel.org/xen-devel/20240313172716.2325427-1-andrew.cooper3= @citrix.com/T/#t --- Changes in V5-V11: - Nothing changed. Only rebase. - Add the footer after Signed-off section. --- Changes in V4: - drop stubs for irq_actor_none() and irq_actor_none() as common/irq.c is = compiled now. - drop defintion of max_page in stubs.c as common/page_alloc.c is compiled= now. - drop printk() related changes in riscv/early_printk.c as common version = will be used. --- Changes in V3: - Reviewed-by: Jan Beulich - unrealted change dropped in tiny64_defconfig --- Changes in V2: - Nothing changed. Only rebase. --- xen/arch/riscv/Makefile | 16 +++- xen/arch/riscv/arch.mk | 4 - xen/arch/riscv/early_printk.c | 168 ---------------------------------- xen/arch/riscv/stubs.c | 24 ----- 4 files changed, 15 insertions(+), 197 deletions(-) diff --git a/xen/arch/riscv/Makefile b/xen/arch/riscv/Makefile index 60afbc0ad9..81b77b13d6 100644 --- a/xen/arch/riscv/Makefile +++ b/xen/arch/riscv/Makefile @@ -12,10 +12,24 @@ $(TARGET): $(TARGET)-syms $(OBJCOPY) -O binary -S $< $@ =20 $(TARGET)-syms: $(objtree)/prelink.o $(obj)/xen.lds - $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) -o $@ + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< \ + $(objtree)/common/symbols-dummy.o -o $(dot-target).0 + $(NM) -pa --format=3Dsysv $(dot-target).0 \ + | $(objtree)/tools/symbols $(all_symbols) --sysv --sort \ + > $(dot-target).0.S + $(MAKE) $(build)=3D$(@D) $(dot-target).0.o + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< \ + $(dot-target).0.o -o $(dot-target).1 + $(NM) -pa --format=3Dsysv $(dot-target).1 \ + | $(objtree)/tools/symbols $(all_symbols) --sysv --sort \ + > $(dot-target).1.S + $(MAKE) $(build)=3D$(@D) $(dot-target).1.o + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \ + $(dot-target).1.o -o $@ $(NM) -pa --format=3Dsysv $@ \ | $(objtree)/tools/symbols --all-symbols --xensyms --sysv --sort \ > $@.map + rm -f $(@D)/.$(@F).[0-9]* =20 $(obj)/xen.lds: $(src)/xen.lds.S FORCE $(call if_changed_dep,cpp_lds_S) diff --git a/xen/arch/riscv/arch.mk b/xen/arch/riscv/arch.mk index 8c071aff65..17827c302c 100644 --- a/xen/arch/riscv/arch.mk +++ b/xen/arch/riscv/arch.mk @@ -38,7 +38,3 @@ extensions :=3D $(subst $(space),,$(extensions)) # -mcmodel=3Dmedlow would force Xen into the lower half. =20 CFLAGS +=3D $(riscv-generic-flags)$(extensions) -mstrict-align -mcmodel=3D= medany - -# TODO: Drop override when more of the build is working -override ALL_OBJS-y =3D arch/$(SRCARCH)/built_in.o -override ALL_LIBS-y =3D diff --git a/xen/arch/riscv/early_printk.c b/xen/arch/riscv/early_printk.c index 60742a042d..610c814f54 100644 --- a/xen/arch/riscv/early_printk.c +++ b/xen/arch/riscv/early_printk.c @@ -40,171 +40,3 @@ void early_printk(const char *str) str++; } } - -/* - * The following #if 1 ... #endif should be removed after printk - * and related stuff are ready. - */ -#if 1 - -#include -#include - -/** - * strlen - Find the length of a string - * @s: The string to be sized - */ -size_t (strlen)(const char * s) -{ - const char *sc; - - for (sc =3D s; *sc !=3D '\0'; ++sc) - /* nothing */; - return sc - s; -} - -/** - * memcpy - Copy one area of memory to another - * @dest: Where to copy to - * @src: Where to copy from - * @count: The size of the area. - * - * You should not use this function to access IO space, use memcpy_toio() - * or memcpy_fromio() instead. - */ -void *(memcpy)(void *dest, const void *src, size_t count) -{ - char *tmp =3D (char *) dest, *s =3D (char *) src; - - while (count--) - *tmp++ =3D *s++; - - return dest; -} - -int vsnprintf(char* str, size_t size, const char* format, va_list args) -{ - size_t i =3D 0; /* Current position in the output string */ - size_t written =3D 0; /* Total number of characters written */ - char* dest =3D str; - - while ( format[i] !=3D '\0' && written < size - 1 ) - { - if ( format[i] =3D=3D '%' ) - { - i++; - - if ( format[i] =3D=3D '\0' ) - break; - - if ( format[i] =3D=3D '%' ) - { - if ( written < size - 1 ) - { - dest[written] =3D '%'; - written++; - } - i++; - continue; - } - - /* - * Handle format specifiers. - * For simplicity, only %s and %d are implemented here. - */ - - if ( format[i] =3D=3D 's' ) - { - char* arg =3D va_arg(args, char*); - size_t arglen =3D strlen(arg); - - size_t remaining =3D size - written - 1; - - if ( arglen > remaining ) - arglen =3D remaining; - - memcpy(dest + written, arg, arglen); - - written +=3D arglen; - i++; - } - else if ( format[i] =3D=3D 'd' ) - { - int arg =3D va_arg(args, int); - - /* Convert the integer to string representation */ - char numstr[32]; /* Assumes a maximum of 32 digits */ - int numlen =3D 0; - int num =3D arg; - size_t remaining; - - if ( arg < 0 ) - { - if ( written < size - 1 ) - { - dest[written] =3D '-'; - written++; - } - - num =3D -arg; - } - - do - { - numstr[numlen] =3D '0' + num % 10; - num =3D num / 10; - numlen++; - } while ( num > 0 ); - - /* Reverse the string */ - for (int j =3D 0; j < numlen / 2; j++) - { - char tmp =3D numstr[j]; - numstr[j] =3D numstr[numlen - 1 - j]; - numstr[numlen - 1 - j] =3D tmp; - } - - remaining =3D size - written - 1; - - if ( numlen > remaining ) - numlen =3D remaining; - - memcpy(dest + written, numstr, numlen); - - written +=3D numlen; - i++; - } - } - else - { - if ( written < size - 1 ) - { - dest[written] =3D format[i]; - written++; - } - i++; - } - } - - if ( size > 0 ) - dest[written] =3D '\0'; - - return written; -} - -void printk(const char *format, ...) -{ - static char buf[1024]; - - va_list args; - va_start(args, format); - - (void)vsnprintf(buf, sizeof(buf), format, args); - - early_printk(buf); - - va_end(args); -} - -#endif - diff --git a/xen/arch/riscv/stubs.c b/xen/arch/riscv/stubs.c index 8285bcffef..bda35fc347 100644 --- a/xen/arch/riscv/stubs.c +++ b/xen/arch/riscv/stubs.c @@ -24,12 +24,6 @@ DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_core_mask); =20 nodemask_t __read_mostly node_online_map =3D { { [0] =3D 1UL } }; =20 -/* - * max_page is defined in page_alloc.c which isn't complied for now. - * definition of max_page will be remove as soon as page_alloc is built. - */ -unsigned long __read_mostly max_page; - /* time.c */ =20 unsigned long __ro_after_init cpu_khz; /* CPU clock frequency in kHz. */ @@ -419,21 +413,3 @@ void __cpu_die(unsigned int cpu) { BUG_ON("unimplemented"); } - -/* - * The following functions are defined in common/irq.c, but common/irq.c i= sn't - * built for now. These changes will be removed there when common/irq.c is - * ready. - */ - -void cf_check irq_actor_none(struct irq_desc *desc) -{ - BUG_ON("unimplemented"); -} - -unsigned int cf_check irq_startup_none(struct irq_desc *desc) -{ - BUG_ON("unimplemented"); - - return 0; -} --=20 2.45.0