From nobody Fri Apr 26 21:08:41 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=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1619528008; cv=none; d=zohomail.com; s=zohoarc; b=Xd2EMp6RZjolksfFgeLjDw7097DfUqAb2sz1tZdvrlRtHdGTzqaThl0ZcQW6CvZPZ+qoABO5k9dX7LORrhCaj0q5XKNqjlCNEkoeRlqLXHVXPGJzjkbVgs8mbvhuNJHS6pa222AU/dM/VQmQ7GCl2Y3GRV5QVJlre9kfHpQOucY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619528008; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5HO69LOYF/q+tMqUDzvDRQvMkLc5+o3wKO8eXoOtaQw=; b=P5p7wqncrhv/Pnks6q6wijQ4vdlQaoICaNqI0+e7MM3NHiQsu+3V/o1rKeRvQxwI91I5bOomHOao2mgHO7d5b6L5ePspO+b5Cwjr+W3hDHbTO83pskkvZoreCSnKor+rBbfS5ELG5rwaN1s5ia/Wqyxn6RugWaIJ8JBpVq1sS1A= 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=quarantine 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 1619528008157189.161965854286; Tue, 27 Apr 2021 05:53:28 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.118424.224524 (Exim 4.92) (envelope-from ) id 1lbNDE-0002rf-3P; Tue, 27 Apr 2021 12:53:12 +0000 Received: by outflank-mailman (output) from mailman id 118424.224524; Tue, 27 Apr 2021 12:53:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lbNDE-0002rY-0T; Tue, 27 Apr 2021 12:53:12 +0000 Received: by outflank-mailman (input) for mailman id 118424; Tue, 27 Apr 2021 12:53:10 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lbNDC-0002rS-6q for xen-devel@lists.xenproject.org; Tue, 27 Apr 2021 12:53:10 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 2f82e92e-5cd4-4e22-a8aa-3c780d14dad7; Tue, 27 Apr 2021 12:53:09 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id BFE99B19D; Tue, 27 Apr 2021 12:53:08 +0000 (UTC) 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: 2f82e92e-5cd4-4e22-a8aa-3c780d14dad7 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1619527988; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5HO69LOYF/q+tMqUDzvDRQvMkLc5+o3wKO8eXoOtaQw=; b=ZcDjdrS+nrZcOBJjf3H1DMDCmoQXr+fLdQGL/aJRjASAKoL2G1J9w6sd678pAZe6s3LfLZ PkAdcOlKWqtOmN/zGwbo1Pd8eD8c2iHT+HYUBm+RYzPM+jA9c0gFM0Ck/PzpHNvcm2ZzQh QL2GNmZgX2Tvr45++JbfNeSjPkPkzYo= Subject: [PATCH 1/7] x86: correct comment about alternatives ordering From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: <6d6da76c-ccc8-afa2-bd06-5ae132c354f2@suse.com> Message-ID: Date: Tue, 27 Apr 2021 14:53:08 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <6d6da76c-ccc8-afa2-bd06-5ae132c354f2@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Unlike Linux, Xen has never (so far) used alternatives patching for memcpy() or memset(), even less such utilizing multiple alternatives. Correct the Linux-inherited comment to match reality. Signed-off-by: Jan Beulich Acked-by: Andrew Cooper --- a/xen/arch/x86/alternative.c +++ b/xen/arch/x86/alternative.c @@ -194,8 +194,7 @@ static void init_or_livepatch _apply_alt /* * The scan order should be from start to end. A later scanned * alternative code can overwrite a previous scanned alternative code. - * Some kernel functions (e.g. memcpy, memset, etc) use this order to - * patch code. + * Some code (e.g. ALTERNATIVE_2()) relies on this order of patching. * * So be careful if you want to change the scan order to any other * order. From nobody Fri Apr 26 21:08:41 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=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1619528070; cv=none; d=zohomail.com; s=zohoarc; b=DWRAfY+UxEHPhYBHOi+oG4N51Cl27tiObL8Pum5YL4gcj0/p4loPboOOaG5lY2n2LuCUZ7JNRktlrT73xTUV4zv0RsmNdTIoNLcJjUPgMMFy8po0b6SP5kZTRfpVo9getnKo5afDLR+QPDsxDMo6ZCi5X0vrAGcZf35XpTf5/CY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619528070; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eSwx+Ch4DJEhXgtanSLj4JnHwm25Fc0vQPq7pvTWlEE=; b=PVvr2U8oC912RLLLdY55sBEp4E0qX1T3V+Fcb6FnFkUIkxzOlzcRk7/dyzzdw29HlEvFePcbcQk5cAleXFqLMcKFU8d5KfDZanans7fj2cTZOxujodG7VEjhhj849attdTltGLPUuSTNYv06j7MTiyd3/e14unXGpKHAxg/ODKs= 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=quarantine 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 1619528070165281.2318717821197; Tue, 27 Apr 2021 05:54:30 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.118428.224536 (Exim 4.92) (envelope-from ) id 1lbNE6-0002z9-DO; Tue, 27 Apr 2021 12:54:06 +0000 Received: by outflank-mailman (output) from mailman id 118428.224536; Tue, 27 Apr 2021 12:54:06 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lbNE6-0002z2-AF; Tue, 27 Apr 2021 12:54:06 +0000 Received: by outflank-mailman (input) for mailman id 118428; Tue, 27 Apr 2021 12:54:05 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lbNE5-0002yx-TK for xen-devel@lists.xenproject.org; Tue, 27 Apr 2021 12:54:05 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id c994d678-aca9-4722-aefb-bf810ac7d32f; Tue, 27 Apr 2021 12:54:04 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id DDFC7B19F; Tue, 27 Apr 2021 12:54:03 +0000 (UTC) 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: c994d678-aca9-4722-aefb-bf810ac7d32f X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1619528044; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eSwx+Ch4DJEhXgtanSLj4JnHwm25Fc0vQPq7pvTWlEE=; b=oDvVJg5gpy9mBJcyTLMIyNUuvSiefpdEUvTwTQReb7RrcaZRVXVG4l4pmQSvG4EGmo6B/d SHgBWTT37Rf5NewaQJS0XZHJWSXKHLqAPGQaxG3e1IVv3HjMLorIWWuq6mhlRzPmxwvs2j Q7OrqCZ7uB604mQ1jFL2Bkh0T1Y8Sdg= Subject: [PATCH 2/7] x86: introduce ioremap_wc() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: <6d6da76c-ccc8-afa2-bd06-5ae132c354f2@suse.com> Message-ID: <0e1d3e9e-ed29-d7e8-e4fc-e48a0454faa4@suse.com> Date: Tue, 27 Apr 2021 14:54:02 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <6d6da76c-ccc8-afa2-bd06-5ae132c354f2@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" In order for a to-be-introduced ERMS form of memcpy() to not regress boot performance on certain systems when video output is active, we first need to arrange for avoiding further dependency on firmware setting up MTRRs in a way we can actually further modify. On many systems, due to the continuously growing amounts of installed memory, MTRRs get configured with at least one huge WB range, and with MMIO ranges below 4Gb then forced to UC via overlapping MTRRs. mtrr_add(), as it is today, can't deal with such a setup. Hence on such systems we presently leave the frame buffer mapped UC, leading to significantly reduced performance when using REP STOSB / REP MOVSB. On post-PentiumII hardware (i.e. any that's capable of running 64-bit code), an effective memory type of WC can be achieved without MTRRs, by simply referencing the respective PAT entry from the PTEs. While this will leave the switch to ERMS forms of memset() and memcpy() with largely unchanged performance, the change here on its own improves performance on affected systems quite significantly: Measuring just the individual affected memcpy() invocations yielded a speedup by a factor of over 250 on my initial (Skylake) test system. memset() isn't getting improved by as much there, but still by a factor of about 20. While adding {__,}PAGE_HYPERVISOR_WC, also add {__,}PAGE_HYPERVISOR_WT to, at the very least, make clear what PTE flags this memory type uses. Signed-off-by: Jan Beulich --- TBD: Both callers are __init, so in principle ioremap_wc() could be so, too, at least for the time being. TBD: If the VGA range is WC in the fixed range MTRRs, reusing the low 1st Mb mapping (like ioremap() does) would be an option. --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -5883,6 +5883,20 @@ void __iomem *ioremap(paddr_t pa, size_t return (void __force __iomem *)va; } =20 +void __iomem *ioremap_wc(paddr_t pa, size_t len) +{ + mfn_t mfn =3D _mfn(PFN_DOWN(pa)); + unsigned int offs =3D pa & (PAGE_SIZE - 1); + unsigned int nr =3D PFN_UP(offs + len); + void *va; + + WARN_ON(page_is_ram_type(mfn_x(mfn), RAM_TYPE_CONVENTIONAL)); + + va =3D __vmap(&mfn, nr, 1, 1, PAGE_HYPERVISOR_WC, VMAP_DEFAULT); + + return (void __force __iomem *)(va + offs); +} + int create_perdomain_mapping(struct domain *d, unsigned long va, unsigned int nr, l1_pgentry_t **pl1tab, struct page_info **ppg) --- a/xen/drivers/video/vesa.c +++ b/xen/drivers/video/vesa.c @@ -9,9 +9,9 @@ #include #include #include +#include #include #include -#include #include "font.h" #include "lfb.h" =20 @@ -103,7 +103,7 @@ void __init vesa_init(void) lfbp.text_columns =3D vlfb_info.width / font->width; lfbp.text_rows =3D vlfb_info.height / font->height; =20 - lfbp.lfb =3D lfb =3D ioremap(lfb_base(), vram_remap); + lfbp.lfb =3D lfb =3D ioremap_wc(lfb_base(), vram_remap); if ( !lfb ) return; =20 @@ -179,8 +179,7 @@ void __init vesa_mtrr_init(void) =20 static void lfb_flush(void) { - if ( vesa_mtrr =3D=3D 3 ) - __asm__ __volatile__ ("sfence" : : : "memory"); + __asm__ __volatile__ ("sfence" : : : "memory"); } =20 void __init vesa_endboot(bool_t keep) --- a/xen/drivers/video/vga.c +++ b/xen/drivers/video/vga.c @@ -79,7 +79,7 @@ void __init video_init(void) { case XEN_VGATYPE_TEXT_MODE_3: if ( page_is_ram_type(paddr_to_pfn(0xB8000), RAM_TYPE_CONVENTIONAL= ) || - ((video =3D ioremap(0xB8000, 0x8000)) =3D=3D NULL) ) + ((video =3D ioremap_wc(0xB8000, 0x8000)) =3D=3D NULL) ) return; outw(0x200a, 0x3d4); /* disable cursor */ columns =3D vga_console_info.u.text_mode_3.columns; @@ -164,7 +164,11 @@ void __init video_endboot(void) { case XEN_VGATYPE_TEXT_MODE_3: if ( !vgacon_keep ) + { memset(video, 0, columns * lines * 2); + iounmap(video); + video =3D ZERO_BLOCK_PTR; + } break; case XEN_VGATYPE_VESA_LFB: case XEN_VGATYPE_EFI_LFB: --- a/xen/include/asm-x86/mm.h +++ b/xen/include/asm-x86/mm.h @@ -615,6 +615,8 @@ void destroy_perdomain_mapping(struct do unsigned int nr); void free_perdomain_mappings(struct domain *); =20 +void __iomem *ioremap_wc(paddr_t, size_t); + extern int memory_add(unsigned long spfn, unsigned long epfn, unsigned int= pxm); =20 void domain_set_alloc_bitsize(struct domain *d); --- a/xen/include/asm-x86/page.h +++ b/xen/include/asm-x86/page.h @@ -349,8 +349,10 @@ void efi_update_l4_pgtable(unsigned int #define __PAGE_HYPERVISOR_RX (_PAGE_PRESENT | _PAGE_ACCESSED) #define __PAGE_HYPERVISOR (__PAGE_HYPERVISOR_RX | \ _PAGE_DIRTY | _PAGE_RW) +#define __PAGE_HYPERVISOR_WT (__PAGE_HYPERVISOR | _PAGE_PWT) #define __PAGE_HYPERVISOR_UCMINUS (__PAGE_HYPERVISOR | _PAGE_PCD) #define __PAGE_HYPERVISOR_UC (__PAGE_HYPERVISOR | _PAGE_PCD | _PAGE_P= WT) +#define __PAGE_HYPERVISOR_WC (__PAGE_HYPERVISOR | _PAGE_PAT) #define __PAGE_HYPERVISOR_SHSTK (__PAGE_HYPERVISOR_RO | _PAGE_DIRTY) =20 #define MAP_SMALL_PAGES _PAGE_AVAIL0 /* don't use superpages mappings */ --- a/xen/include/asm-x86/x86_64/page.h +++ b/xen/include/asm-x86/x86_64/page.h @@ -154,6 +154,10 @@ static inline intpte_t put_pte_flags(uns _PAGE_GLOBAL | _PAGE_NX) #define PAGE_HYPERVISOR_UC (__PAGE_HYPERVISOR_UC | \ _PAGE_GLOBAL | _PAGE_NX) +#define PAGE_HYPERVISOR_WC (__PAGE_HYPERVISOR_WC | \ + _PAGE_GLOBAL | _PAGE_NX) +#define PAGE_HYPERVISOR_WT (__PAGE_HYPERVISOR_WT | \ + _PAGE_GLOBAL | _PAGE_NX) =20 #endif /* __X86_64_PAGE_H__ */ =20 From nobody Fri Apr 26 21:08:41 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=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1619528104; cv=none; d=zohomail.com; s=zohoarc; b=Qgd/PPEyDe+r+5hfCMtI6mj8P+0jxwUTFKtdlUc3yOM2IyP42eLoZHFSlQRdIbgJGYqNCLX5CMNLsKoJtn5Ymb2pV6gJWSSrSncdgXmY5vMrWqxLP7lgEClZvwxdLAMvPkiw0HaBrXEN0uOA9p+lTUid2ePsQtFJWViE1WWrmyA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619528104; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0I4gNzPs7QkUzQaZgNM9qNeznBTvZe1/bKfap9B3u8w=; b=gGwJY6FSWP8kqeEmDBC0QVcukORmGZIRfveOdD+AVnSU9ql9N4seroeSL9w3gh2fbKFp6RQ5eN1W4+90MrNYU+tzJVyHr9eWCilaOMKv2u+suxVmf5pCyrk5WRmRoeovaidN3aNnpnIG/KuSwK5XKhng9Yn8LOggr8iVGtrsRgY= 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=quarantine 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 16195281043851010.5093230701718; Tue, 27 Apr 2021 05:55:04 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.118431.224547 (Exim 4.92) (envelope-from ) id 1lbNER-000344-M3; Tue, 27 Apr 2021 12:54:27 +0000 Received: by outflank-mailman (output) from mailman id 118431.224547; Tue, 27 Apr 2021 12:54:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lbNER-00033x-JB; Tue, 27 Apr 2021 12:54:27 +0000 Received: by outflank-mailman (input) for mailman id 118431; Tue, 27 Apr 2021 12:54:26 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lbNEQ-00033m-RI for xen-devel@lists.xenproject.org; Tue, 27 Apr 2021 12:54:26 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 4090ac78-7dfd-47aa-a158-bc6b57c317a1; Tue, 27 Apr 2021 12:54:26 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 63310B1A4; Tue, 27 Apr 2021 12:54:25 +0000 (UTC) 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: 4090ac78-7dfd-47aa-a158-bc6b57c317a1 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1619528065; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0I4gNzPs7QkUzQaZgNM9qNeznBTvZe1/bKfap9B3u8w=; b=I1oe92Je8Git0pBVz5wloJ4ZcuaPiMaX7eJBoYyZQdx0mtYAQ54W+1WpH7FSXlhvqcgJIs 4fkkcoxEaCh2Om/DNFlrYGGZNRTpTSqk0bQBE73DQTXILdvr2G+26UzAAL1asdq5Ngy8Jw y/ZvERG+fdVMDvdcI9Zci1cSX7k6jio= Subject: [PATCH 3/7] x86: re-work memset() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: <6d6da76c-ccc8-afa2-bd06-5ae132c354f2@suse.com> Message-ID: Date: Tue, 27 Apr 2021 14:54:24 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <6d6da76c-ccc8-afa2-bd06-5ae132c354f2@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Move the function to its own assembly file. Having it in C just for the entire body to be an asm() isn't really helpful. Then have two flavors: A "basic" version using qword steps for the bulk of the operation, and an ERMS version for modern hardware, to be substituted in via alternatives patching. Signed-off-by: Jan Beulich --- We may want to consider branching over the REP STOSQ as well, if the number of qwords turns out to be zero. We may also want to consider using non-REP STOS{L,W,B} for the tail. --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -43,6 +43,7 @@ obj-$(CONFIG_INDIRECT_THUNK) +=3D indirect obj-y +=3D ioport_emulate.o obj-y +=3D irq.o obj-$(CONFIG_KEXEC) +=3D machine_kexec.o +obj-y +=3D memset.o obj-y +=3D mm.o x86_64/mm.o obj-$(CONFIG_HVM) +=3D monitor.o obj-y +=3D mpparse.o --- /dev/null +++ b/xen/arch/x86/memset.S @@ -0,0 +1,31 @@ +#include + +.macro memset + and $7, %edx + shr $3, %rcx + movzbl %sil, %esi + mov $0x0101010101010101, %rax + imul %rsi, %rax + mov %rdi, %rsi + rep stosq + or %edx, %ecx + jz 0f + rep stosb +0: + mov %rsi, %rax + ret +.endm + +.macro memset_erms + mov %esi, %eax + mov %rdi, %rsi + rep stosb + mov %rsi, %rax + ret +.endm + +ENTRY(memset) + mov %rdx, %rcx + ALTERNATIVE memset, memset_erms, X86_FEATURE_ERMS + .type memset, @function + .size memset, . - memset --- a/xen/arch/x86/string.c +++ b/xen/arch/x86/string.c @@ -22,19 +22,6 @@ void *(memcpy)(void *dest, const void *s return dest; } =20 -void *(memset)(void *s, int c, size_t n) -{ - long d0, d1; - - asm volatile ( - "rep stosb" - : "=3D&c" (d0), "=3D&D" (d1) - : "a" (c), "1" (s), "0" (n) - : "memory"); - - return s; -} - void *(memmove)(void *dest, const void *src, size_t n) { long d0, d1, d2; From nobody Fri Apr 26 21:08:41 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=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1619528107; cv=none; d=zohomail.com; s=zohoarc; b=euPhrze/4/8mv21APwamkEtKh9Ok8/KUmq/OeVF2Vysf5Uwgw2CMDFSZcsxCEBMKeoFKnRDNlFXQAw4KFxrhv/AOzRLfQzthUdEvTiMEzBBh0Hqk8m7q+oNYxhifl0QV7cUCBsH/KZz2melXirfLmHINgjmz52LH2ADPdPgQ9Io= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619528107; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8iVlQanP290BLy02LDzP89TcI1dKH7MaEcZKdyou000=; b=WpXOomdo0QXF5ioVZLfnjUrkYbZrT66sTGKCINplD/DBgmoldleiZmluNyuvs8NdZ+kHzACXYs2UaiwANZhR0SJyk5CKm+HC85hUgLX3VxMXBbZ1j1NH0hERSxr5hJSxhWxqZTf5FegggWtVX/Bv7P5iY8dCLn+VwmfLlkPRDP0= 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=quarantine 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 1619528107118163.7532077672986; Tue, 27 Apr 2021 05:55:07 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.118435.224560 (Exim 4.92) (envelope-from ) id 1lbNEl-0003B6-W5; Tue, 27 Apr 2021 12:54:47 +0000 Received: by outflank-mailman (output) from mailman id 118435.224560; Tue, 27 Apr 2021 12:54:47 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lbNEl-0003Ay-Rg; Tue, 27 Apr 2021 12:54:47 +0000 Received: by outflank-mailman (input) for mailman id 118435; Tue, 27 Apr 2021 12:54:46 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lbNEk-00039o-7d for xen-devel@lists.xenproject.org; Tue, 27 Apr 2021 12:54:46 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 0232e8a0-3c79-4da9-b604-6f2b1bf4d1cc; Tue, 27 Apr 2021 12:54:44 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 0A119B190; Tue, 27 Apr 2021 12:54:44 +0000 (UTC) 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: 0232e8a0-3c79-4da9-b604-6f2b1bf4d1cc X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1619528084; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8iVlQanP290BLy02LDzP89TcI1dKH7MaEcZKdyou000=; b=b0wz4jX28laKvsVX8HiLepw1mQA2W8pJiR97VNGmmr0IosgDIIiYOiuYunPlOX5e1u2Am6 Vu6jHC2KcAxsMueg287YK4yXoJj5VQM6PD3IOfemwaEb/OEmVM+S0cNlycjnyOZfgYHO2B tz92XjOFrtxds7v94a+30uAFkC2h5XE= Subject: [PATCH 4/7] x86: re-work memcpy() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: <6d6da76c-ccc8-afa2-bd06-5ae132c354f2@suse.com> Message-ID: <58bd0a42-4700-cf02-94a5-d68a22cbec1a@suse.com> Date: Tue, 27 Apr 2021 14:54:43 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <6d6da76c-ccc8-afa2-bd06-5ae132c354f2@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Move the function to its own assembly file. Having it in C just for the entire body to be an asm() isn't really helpful. Then have two flavors: A "basic" version using qword steps for the bulk of the operation, and an ERMS version for modern hardware, to be substituted in via alternatives patching. Alternatives patching, however, requires an extra precaution: It uses memcpy() itself, and hence the function may patch itself. Luckily the patched-in code only replaces the prolog of the original function. Make sure this remains this way. Additionally alternatives patching, while supposedly safe via enforcing a control flow change when modifying already prefetched code, may not really be. Afaict a request is pending to drop the first of the two options in the SDM's "Handling Self- and Cross-Modifying Code" section. Insert a serializing instruction there. To avoid having to introduce a local variable, also switch text_poke() to return void: Neither of its callers cares about the returned value. Signed-off-by: Jan Beulich --- We may want to consider branching over the REP MOVSQ as well, if the number of qwords turns out to be zero. We may also want to consider using non-REP MOVS{L,W,B} for the tail. --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -43,6 +43,7 @@ obj-$(CONFIG_INDIRECT_THUNK) +=3D indirect obj-y +=3D ioport_emulate.o obj-y +=3D irq.o obj-$(CONFIG_KEXEC) +=3D machine_kexec.o +obj-y +=3D memcpy.o obj-y +=3D memset.o obj-y +=3D mm.o x86_64/mm.o obj-$(CONFIG_HVM) +=3D monitor.o --- a/xen/arch/x86/alternative.c +++ b/xen/arch/x86/alternative.c @@ -164,12 +164,14 @@ void init_or_livepatch add_nops(void *in * executing. * * "noinline" to cause control flow change and thus invalidate I$ and - * cause refetch after modification. + * cause refetch after modification. While the SDM continues to suggest t= his + * is sufficient, it may not be - issue a serializing insn afterwards as w= ell. */ -static void *init_or_livepatch noinline +static void init_or_livepatch noinline text_poke(void *addr, const void *opcode, size_t len) { - return memcpy(addr, opcode, len); + memcpy(addr, opcode, len); + cpuid_eax(0); } =20 /* --- /dev/null +++ b/xen/arch/x86/memcpy.S @@ -0,0 +1,21 @@ +#include + +ENTRY(memcpy) + mov %rdx, %rcx + mov %rdi, %rax + /* + * We need to be careful here: memcpy() is involved in alternatives + * patching, so the code doing the actual copying (i.e. past setti= ng + * up registers) may not be subject to patching (unless further + * precautions were taken). + */ + ALTERNATIVE "and $7, %edx; shr $3, %rcx", \ + "rep movsb; ret", X86_FEATURE_ERMS + rep movsq + or %edx, %ecx + jz 1f + rep movsb +1: + ret + .type memcpy, @function + .size memcpy, . - memcpy --- a/xen/arch/x86/string.c +++ b/xen/arch/x86/string.c @@ -7,21 +7,6 @@ =20 #include =20 -void *(memcpy)(void *dest, const void *src, size_t n) -{ - long d0, d1, d2; - - asm volatile ( - " rep ; movs"__OS" ; " - " mov %k4,%k3 ; " - " rep ; movsb " - : "=3D&c" (d0), "=3D&D" (d1), "=3D&S" (d2) - : "0" (n/BYTES_PER_LONG), "r" (n%BYTES_PER_LONG), "1" (dest), "2" = (src) - : "memory" ); - - return dest; -} - void *(memmove)(void *dest, const void *src, size_t n) { long d0, d1, d2; From nobody Fri Apr 26 21:08:41 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=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1619528157; cv=none; d=zohomail.com; s=zohoarc; b=eqQakSj+nhfgLgKp/wm+9MW/hw4ScwsX74Q7qftj+2/6g5TjU/KNYFffTm7nWuW5o17QJ9AWdtmMhg6zl0BAVtU9rJChFB+i2/ezgudT6/4ugckKbwFV56fpy4yw2lqDOtlrQajHMh4VEzR2QX/8riTzHgIQDROHdUxN7nvKFr0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619528157; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=s14UwhbZNQTt7lOAtjre/DnjC1roVy/CdMyBN/BeKjU=; b=Q/abZYmHDiPcCgukKSNfTr6s3+6PuXgelS6IIB/ymXa/F3ylBW+ZJiY69jumRRvnMx49caUk//JdvvY924V083Hiy4nY9vHx9oujp55ZvP7szXsU3Q2SyxjWnc3ZJOJakp/1Y4Urir+DZO+hMabgR/R5J/z4VWi8UuU9OZIKjoU= 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=quarantine 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 161952815721185.39684407094876; Tue, 27 Apr 2021 05:55:57 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.118444.224572 (Exim 4.92) (envelope-from ) id 1lbNFN-0003M6-8C; Tue, 27 Apr 2021 12:55:25 +0000 Received: by outflank-mailman (output) from mailman id 118444.224572; Tue, 27 Apr 2021 12:55:25 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lbNFN-0003Ly-52; Tue, 27 Apr 2021 12:55:25 +0000 Received: by outflank-mailman (input) for mailman id 118444; Tue, 27 Apr 2021 12:55:23 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lbNFL-0003Lo-Mt for xen-devel@lists.xenproject.org; Tue, 27 Apr 2021 12:55:23 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 3bb411cd-11a1-47c0-b1a6-4f2ce7d9945b; Tue, 27 Apr 2021 12:55:23 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 5F6FAB190; Tue, 27 Apr 2021 12:55:22 +0000 (UTC) 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: 3bb411cd-11a1-47c0-b1a6-4f2ce7d9945b X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1619528122; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=s14UwhbZNQTt7lOAtjre/DnjC1roVy/CdMyBN/BeKjU=; b=j0ZgO+8VYxR9jYhyKz3/FGOkEndMeocpXtE5n0MpwOczBwQyH4bAc+PGBsMTydViUUedqr v/W1obmYpbHqxLSrteNgjyW3Uj1gJqC983XytjkDhGjHdRkF5Mbus7VNZdhqYVuxqS14jK 3Tok0bQaM9vLrZImIvz/6Bqp0CNTYQE= Subject: [PATCH 5/7] video/vesa: unmap frame buffer when relinquishing console From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: <6d6da76c-ccc8-afa2-bd06-5ae132c354f2@suse.com> Message-ID: <46af3a52-e0e3-a85e-7957-21bee8877836@suse.com> Date: Tue, 27 Apr 2021 14:55:21 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <6d6da76c-ccc8-afa2-bd06-5ae132c354f2@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" There's no point in keeping the VA space occupied when no further output will occur. Signed-off-by: Jan Beulich --- a/xen/drivers/video/lfb.c +++ b/xen/drivers/video/lfb.c @@ -168,4 +168,5 @@ void lfb_free(void) xfree(lfb.lbuf); xfree(lfb.text_buf); xfree(lfb.line_len); + lfb.lfbp.lfb =3D ZERO_BLOCK_PTR; } --- a/xen/drivers/video/vesa.c +++ b/xen/drivers/video/vesa.c @@ -197,5 +197,7 @@ void __init vesa_endboot(bool_t keep) vlfb_info.width * bpp); lfb_flush(); lfb_free(); + iounmap(lfb); + lfb =3D ZERO_BLOCK_PTR; } } From nobody Fri Apr 26 21:08:41 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=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1619528192; cv=none; d=zohomail.com; s=zohoarc; b=Vx+x6xPn+R8HCh2rUDOn6flMjoXLIHvMWDfv/E/sd8eupqd5QmWlnSoDYsdYpLIqKotcOGKrT94AcrmaAVDAHFXq7t8pzm7R20EBgl1htwGWTVxA1JADWuv0ehOqkoZlCgklU0IgFZqcbe+xqlVLtTI7NXrYf4ABkvsqbKku/tA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619528192; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3OIBovXA6yG6lrqXw8NYqJSgjs0t+0xYyiIEpQitrFw=; b=mT0ESHz/29UrVWAvpuFcyX9huRbwIUPq1AchDVlA5DmSvTtcVJxSU5I/z2YBaxOQEED4LXp9lNlrR9lh05jYat7lXfgGc1oCb+OBfjAtY66c1iItx82fVvjm/CKbB061NN2s/9NpqGeq/6I5ypSa4MY+jDw/9iDMB6ZhiEBzv94= 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=quarantine 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 1619528192837768.0502508506761; Tue, 27 Apr 2021 05:56:32 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.118451.224584 (Exim 4.92) (envelope-from ) id 1lbNG2-0003U9-Gy; Tue, 27 Apr 2021 12:56:06 +0000 Received: by outflank-mailman (output) from mailman id 118451.224584; Tue, 27 Apr 2021 12:56:06 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lbNG2-0003U2-E0; Tue, 27 Apr 2021 12:56:06 +0000 Received: by outflank-mailman (input) for mailman id 118451; Tue, 27 Apr 2021 12:56:04 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lbNG0-0003Tr-JM for xen-devel@lists.xenproject.org; Tue, 27 Apr 2021 12:56:04 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id b7ab6b57-a9d3-4583-b7f3-7c3c671f4866; Tue, 27 Apr 2021 12:56:03 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 5C9A5B1A1; Tue, 27 Apr 2021 12:56:02 +0000 (UTC) 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: b7ab6b57-a9d3-4583-b7f3-7c3c671f4866 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1619528162; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3OIBovXA6yG6lrqXw8NYqJSgjs0t+0xYyiIEpQitrFw=; b=St9ue35hfYB7GEoMBFRtGvR00USUKgO8QlS7VRtGVGYx7OMMLjOBOFIrbNEQ9eNnpT3Leg bTvW7UE+qP9M3QyVchtbNRsKcAEB7sjJjJ0/kwp9PPPsMexoIS8I1l2ju+v8JHhG6g96dM sm3ZQe+ol/62Pu1f5X31BsCFXP8XkzY= Subject: [PATCH 6/7] video/vesa: drop "vesa-mtrr" command line option From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: <6d6da76c-ccc8-afa2-bd06-5ae132c354f2@suse.com> Message-ID: Date: Tue, 27 Apr 2021 14:56:01 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <6d6da76c-ccc8-afa2-bd06-5ae132c354f2@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Now that we use ioremap_wc() for mapping the frame buffer, there's no need for this option anymore. As noted in the change introducing the use of ioremap_wc(), mtrr_add() didn't work in certain cases anyway. Signed-off-by: Jan Beulich Acked-by: Andrew Cooper --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog =20 ## [unstable UNRELEASED](https://xenbits.xen.org/gitweb/?p=3Dxen.git;a=3Ds= hortlog;h=3Dstaging) - TBD =20 +### Removed / support downgraded + - dropped support for the (x86-only) "vesa-mtrr" command line option + ## [4.15.0 UNRELEASED](https://xenbits.xen.org/gitweb/?p=3Dxen.git;a=3Dsho= rtlog;h=3DRELEASE-4.15.0) - TBD =20 ### Added / support upgraded --- a/docs/misc/xen-command-line.pandoc +++ b/docs/misc/xen-command-line.pandoc @@ -2369,9 +2369,6 @@ cache-warming. 1ms (1000) has been measu ### vesa-map > `=3D ` =20 -### vesa-mtrr -> `=3D ` - ### vesa-ram > `=3D ` =20 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1813,8 +1813,6 @@ void __init noreturn __start_xen(unsigne =20 local_irq_enable(); =20 - vesa_mtrr_init(); - early_msi_init(); =20 iommu_setup(); /* setup iommu if available */ --- a/xen/drivers/video/vesa.c +++ b/xen/drivers/video/vesa.c @@ -145,38 +145,6 @@ void __init vesa_init(void) video_puts =3D lfb_redraw_puts; } =20 -#include - -static unsigned int vesa_mtrr; -integer_param("vesa-mtrr", vesa_mtrr); - -void __init vesa_mtrr_init(void) -{ - static const int mtrr_types[] =3D { - 0, MTRR_TYPE_UNCACHABLE, MTRR_TYPE_WRBACK, - MTRR_TYPE_WRCOMB, MTRR_TYPE_WRTHROUGH }; - unsigned int size_total; - int rc, type; - - if ( !lfb || (vesa_mtrr =3D=3D 0) || (vesa_mtrr >=3D ARRAY_SIZE(mtrr_t= ypes)) ) - return; - - type =3D mtrr_types[vesa_mtrr]; - if ( !type ) - return; - - /* Find the largest power-of-two */ - size_total =3D vram_total; - while ( size_total & (size_total - 1) ) - size_total &=3D size_total - 1; - - /* Try and find a power of two to add */ - do { - rc =3D mtrr_add(lfb_base(), size_total, type, 1); - size_total >>=3D 1; - } while ( (size_total >=3D PAGE_SIZE) && (rc =3D=3D -EINVAL) ); -} - static void lfb_flush(void) { __asm__ __volatile__ ("sfence" : : : "memory"); --- a/xen/include/asm-x86/setup.h +++ b/xen/include/asm-x86/setup.h @@ -25,10 +25,8 @@ void init_IRQ(void); =20 #ifdef CONFIG_VIDEO void vesa_init(void); -void vesa_mtrr_init(void); #else static inline void vesa_init(void) {}; -static inline void vesa_mtrr_init(void) {}; #endif =20 int construct_dom0( From nobody Fri Apr 26 21:08:41 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=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1619528213; cv=none; d=zohomail.com; s=zohoarc; b=dvnsKcmJY83/0LcxCRECuJU90s+fWporKn8eOKSqE8ZM0rFmHE0JyUE5wqJkaocrAE65nnMt9wCoJPqD7f8KMiuE+8gW400xqeaEQdiQ/uvaJvZvl9Sf7qEdSMxETX2xDfg2pSHtOX7VYhxJhFE2+rQU27jqKOikgDreRvrfnDU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619528213; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=P0oy01Y/07q3+WCTPLWPJmj0XnG5cCqIDnUl08wgz+c=; b=VssFjo4ty53rq6GoG0DkWJxlSQKI/lHwyCBdnIUuIZ3GyY2RjyR1HFzn1E40dwg3wc6TxUOnGwlU3hHiHq2Fs9vNGK/m8OlsUhhcXtmV6mX8XsKTaX+G5OzjevkLaqQmQA1Fy7iAuvQV5MlmvlQtJGHGGa+TQk3+KKxV8KQXxM8= 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=quarantine 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 16195282134271009.9499184409556; Tue, 27 Apr 2021 05:56:53 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.118459.224596 (Exim 4.92) (envelope-from ) id 1lbNGV-0003bp-Uf; Tue, 27 Apr 2021 12:56:35 +0000 Received: by outflank-mailman (output) from mailman id 118459.224596; Tue, 27 Apr 2021 12:56:35 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lbNGV-0003bi-R5; Tue, 27 Apr 2021 12:56:35 +0000 Received: by outflank-mailman (input) for mailman id 118459; Tue, 27 Apr 2021 12:56:35 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lbNGV-0003bb-7O for xen-devel@lists.xenproject.org; Tue, 27 Apr 2021 12:56:35 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id c390bd37-2823-428f-b64b-871f8272425d; Tue, 27 Apr 2021 12:56:34 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id AFE0EB190; Tue, 27 Apr 2021 12:56:33 +0000 (UTC) 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: c390bd37-2823-428f-b64b-871f8272425d X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1619528193; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=P0oy01Y/07q3+WCTPLWPJmj0XnG5cCqIDnUl08wgz+c=; b=dTXmFjwO5z3Xu+AfHxr94gHX42Lej1gFRshWInrkSPuCTHllJ2i6q7EDkkaPGmZ5fEkp/C UYuu9rmBpUGfMYP+X/6FBuKn8VZyVn4geK6ZwVckLEAOBmGtlnRKQ+q0MR1h97F9/ct0Z6 0oZt6s44BuFyKAbFKdZdJqAt1vVeDB8= Subject: [PATCH 7/7] video/vesa: adjust (not just) command line option handling From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: <6d6da76c-ccc8-afa2-bd06-5ae132c354f2@suse.com> Message-ID: <7e3f69d7-23e8-397d-72b6-8c489d80ea45@suse.com> Date: Tue, 27 Apr 2021 14:56:33 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <6d6da76c-ccc8-afa2-bd06-5ae132c354f2@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Document both options. Add section annotations to both variables holding the parsed values as well as a few adjacent ones. Adjust the types of font_height and vga_compat. Signed-off-by: Jan Beulich --- a/docs/misc/xen-command-line.pandoc +++ b/docs/misc/xen-command-line.pandoc @@ -2369,9 +2369,21 @@ cache-warming. 1ms (1000) has been measu ### vesa-map > `=3D ` =20 +> Default: `0` + +Specify, in MiB, the portion of video RAM to actually remap. This will be +honored only when large enough to cover the space needed for the chosen vi= deo +mode, and only when less than a non-zero value possibly specified through +'vesa-ram'. + ### vesa-ram > `=3D ` =20 +> Default: `0` + +This allows to override the amount of video RAM, in MiB, determined to be +present. + ### vga > `=3D ( ask | current | text-80x | gfx-xx | m= ode- )[,keep]` =20 --- a/xen/drivers/video/vesa.c +++ b/xen/drivers/video/vesa.c @@ -19,17 +19,17 @@ =20 static void lfb_flush(void); =20 -static unsigned char *lfb; -static const struct font_desc *font; -static bool_t vga_compat; +static unsigned char *__read_mostly lfb; +static const struct font_desc *__initdata font; +static bool __initdata vga_compat; =20 -static unsigned int vram_total; +static unsigned int __initdata vram_total; integer_param("vesa-ram", vram_total); =20 -static unsigned int vram_remap; +static unsigned int __initdata vram_remap; integer_param("vesa-map", vram_remap); =20 -static int font_height; +static unsigned int __initdata font_height; static int __init parse_font_height(const char *s) { if ( simple_strtoul(s, &s, 10) =3D=3D 8 && (*s++ =3D=3D 'x') )