* Re: [docs] [PATCH] ref-system-requirements: update supported hosts lists
From: Steve Sakoman @ 2020-07-16 22:55 UTC (permalink / raw)
To: akuster808; +Cc: docs
In-Reply-To: <776527fe-3306-c772-103d-5632b4475809@gmail.com>
On Thu, Jul 16, 2020 at 12:35 PM akuster808 <akuster808@gmail.com> wrote:
>
> Dunfell needs updating too but I am not sure if we can remove hosts that are no longer in the AB like Ubuntu 19.04 or the Fedora ones.
I was just about to send a similar patch for dunfell.
My assumption is that we don't remove previously supported distros
from LTS. Someone correct me if I'm mistaken!
Steve
>
> - armin
>
> On 7/16/20 3:27 PM, akuster via lists.yoctoproject.org wrote:
>
> drop Ubuntu 19, Fedora 28 & 29
> Add: Fedora 31, 32 , Centos 8 and Ubuntu 20
>
> Signed-off-by: Armin Kuster <akuster808@gmail.com>
> ---
> documentation/ref-manual/ref-system-requirements.xml | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/documentation/ref-manual/ref-system-requirements.xml b/documentation/ref-manual/ref-system-requirements.xml
> index 43e217c6d..ac8b0032d 100644
> --- a/documentation/ref-manual/ref-system-requirements.xml
> +++ b/documentation/ref-manual/ref-system-requirements.xml
> @@ -94,11 +94,12 @@
> <itemizedlist>
> <listitem><para>Ubuntu 16.04 (LTS)</para></listitem>
> <listitem><para>Ubuntu 18.04 (LTS)</para></listitem>
> - <listitem><para>Ubuntu 19.04</para></listitem>
> - <listitem><para>Fedora 28</para></listitem>
> - <listitem><para>Fedora 29</para></listitem>
> + <listitem><para>Ubuntu 20.04</para></listitem>
> <listitem><para>Fedora 30</para></listitem>
> + <listitem><para>Fedora 31</para></listitem>
> + <listitem><para>Fedora 32</para></listitem>
> <listitem><para>CentOS 7.x</para></listitem>
> + <listitem><para>CentOS 8.x</para></listitem>
> <listitem><para>Debian GNU/Linux 8.x (Jessie)</para></listitem>
> <listitem><para>Debian GNU/Linux 9.x (Stretch)</para></listitem>
> <listitem><para>Debian GNU/Linux 10.x (Buster)</para></listitem>
>
>
>
>
>
^ permalink raw reply
* Re: [poky] [meta-yocto][dunfell] poky: Add fedora32 as a supported distro
From: akuster @ 2020-07-16 22:52 UTC (permalink / raw)
To: Steve Sakoman; +Cc: poky
In-Reply-To: <CAOSpxdax5K5ty-PgyfCdnvZoZVruPcX2+-n-+7CT7a4ZjgXvaQ@mail.gmail.com>
On 7/16/20 3:48 PM, Steve Sakoman wrote:
> On Thu, Jul 16, 2020 at 12:31 PM akuster808 <akuster808@gmail.com> wrote:
>> I believe Ubuntu 19.x has been removed from the AB. Not sure if this file need to reflect that or not?
> I think not, otherwise users who are currently using Ubuntu 19.x will
> get an error when they upgrade to the latest version of dunfell.
>
> Of course things may break on Ubuntu 19.x at some point since we
> aren't testing it, but we can deal with that when we get reports.
just had to ask. Sounds reasonable.
-armin
> Steve
>
>
> Steve
>
>> -armin
>>
>> On 7/16/20 3:11 PM, Steve Sakoman wrote:
>>
>> Signed-off-by: Steve Sakoman <steve@sakoman.com>
>> ---
>> meta-poky/conf/distro/poky.conf | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/meta-poky/conf/distro/poky.conf b/meta-poky/conf/distro/poky.conf
>> index 7c4a285..7f0a157 100644
>> --- a/meta-poky/conf/distro/poky.conf
>> +++ b/meta-poky/conf/distro/poky.conf
>> @@ -59,6 +59,7 @@ SANITY_TESTED_DISTROS ?= " \
>> ubuntu-20.04 \n \
>> fedora-30 \n \
>> fedora-31 \n \
>> + fedora-32 \n \
>> centos-7 \n \
>> centos-8 \n \
>> debian-8 \n \
>>
>>
>>
>>
>>
^ permalink raw reply
* Re: [dpdk-dev] [PATCH] net/bnxt: remove unneeded experimental build flag
From: Ajit Khaparde @ 2020-07-16 22:50 UTC (permalink / raw)
To: David Marchand
Cc: dpdk-dev, Ferruh Yigit, Somnath Kotur, Venkat Duvvuru, Kalesh AP
In-Reply-To: <20200716072618.2907-1-david.marchand@redhat.com>
On Thu, Jul 16, 2020 at 12:26 AM David Marchand <david.marchand@redhat.com>
wrote:
> -DALLOW_EXPERIMENTAL_API is always set for in-tree compilation.
> See https://git.dpdk.org/dpdk/commit/?id=acec04c4b2f5
>
> Fixes: 322bd6e70272 ("net/bnxt: add port representor infrastructure")
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ---
> drivers/net/bnxt/Makefile | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/net/bnxt/Makefile b/drivers/net/bnxt/Makefile
> index c54fd108d1..2c4cdd1c40 100644
> --- a/drivers/net/bnxt/Makefile
> +++ b/drivers/net/bnxt/Makefile
> @@ -14,7 +14,6 @@ LIB = librte_pmd_bnxt.a
> EXPORT_MAP := rte_pmd_bnxt_version.map
>
> CFLAGS += -O3
> -CFLAGS += -DALLOW_EXPERIMENTAL_API
> CFLAGS += $(WERROR_FLAGS)
> LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
> LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
> --
> 2.23.0
>
>
^ permalink raw reply
* Re: [PATCH 0/2] Modularization of DFL private feature drivers
From: Tom Rix @ 2020-07-16 22:50 UTC (permalink / raw)
To: Xu Yilun, mdf, linux-fpga, linux-kernel; +Cc: lgoncalv
In-Reply-To: <1594791498-14495-1-git-send-email-yilun.xu@intel.com>
Generally i think this is a good approach.
However I do have concern.
The feature_id in dfl is magic number, similar to pci id but without a vendor id.
Is it possible to add something like a vendor id so different vendors would not have to be so careful to use a unique id ?
This touches some of the matching function of the bus ops. Could there be a way for bus ops to be used so that there could be multiple matching function. Maybe the one in 0002 as a default so users could override it ?
The use case I am worrying about is an OEM. The OEM uses an unclaimed feature_id and supplies their own platform device device driver to match the feature_id. But some later version of the kernel claims this feature_id and the OEM's driver no longer works and since the value comes from pci config space it is difficult to change.
So looking for something like
register_feature_matcher((*bus_match)(struct device *dev, struct device_driver *drv))
static int dfl_bus_match_default(struct device *dev, struct device_driver *drv)
{
struct dfl_device *dfl_dev = to_dfl_dev(dev);
struct dfl_driver *dfl_drv = to_dfl_drv(drv);
const struct dfl_device_id *id_entry = dfl_drv->id_table;
while (id_entry->feature_id) {
if (dfl_match_one_device(id_entry, dfl_dev)) {
dfl_dev->id_entry = id_entry;
return 1;
}
id_entry++;
}
return 0;
}
register_feature_matcher(&dfl_bus_match_default)
static int dfl_bus_match(struct device *dev, struct device_driver *drv)
{
struct dfl_device *dfl_dev = to_dfl_dev(dev);
struct dfl_driver *dfl_drv = to_dfl_drv(drv);
const struct dfl_device_id *id_entry = dfl_drv->id_table;
while (id_entry->feature_id) {
matcher = Loop over matchers()
if (matcher(dev, drv)) {
dfl_dev->id_entry = id_entry;
return 1;
}
id_entry++;
}
return 0;
}
Or maybe use some of the unused bits in the dfl header to add a second vendor-like id and change existing matcher to look feature_id and vendor_like_id.
Tom
On 7/14/20 10:38 PM, Xu Yilun wrote:
> This patchset makes it possible to develop independent driver modules
> for DFL private features. It also helps to leverage existing kernel
> drivers to enable some IP blocks in DFL.
>
> Xu Yilun (2):
> fpga: dfl: map feature mmio resources in their own feature drivers
> fpga: dfl: create a dfl bus type to support DFL devices
>
> Documentation/ABI/testing/sysfs-bus-dfl | 15 ++
> drivers/fpga/dfl-pci.c | 21 +-
> drivers/fpga/dfl.c | 435 +++++++++++++++++++++++++++-----
> drivers/fpga/dfl.h | 91 ++++++-
> 4 files changed, 492 insertions(+), 70 deletions(-)
> create mode 100644 Documentation/ABI/testing/sysfs-bus-dfl
>
^ permalink raw reply
* Re: [RFC PATCH v3 16/18] gpu: host1x: mipi: Split tegra_mipi_calibrate and tegra_mipi_wait
From: Sowjanya Komatineni @ 2020-07-16 22:49 UTC (permalink / raw)
To: Dmitry Osipenko, thierry.reding, jonathanh, frankc, hverkuil,
sakari.ailus, robh+dt, helen.koike
Cc: sboyd, gregkh, linux-media, devicetree, linux-tegra, linux-kernel,
linux-i2c
In-Reply-To: <c4945c77-5de1-e9b1-9f4f-cdd78bca18c7@gmail.com>
On 7/16/20 2:18 PM, Dmitry Osipenko wrote:
> 17.07.2020 00:09, Sowjanya Komatineni пишет:
>> On 7/16/20 1:38 PM, Dmitry Osipenko wrote:
>>> 15.07.2020 07:20, Sowjanya Komatineni пишет:
>>>> SW can trigger MIPI pads calibration any time after power on
>>>> but calibration results will be latched and applied to the pads
>>>> by MIPI CAL unit only when the link is in LP-11 state and then
>>>> status register will be updated.
>>>>
>>>> For CSI, trigger of pads calibration happen during CSI stream
>>>> enable where CSI receiver is kept ready prior to sensor or CSI
>>>> transmitter stream start.
>>>>
>>>> So, pads may not be in LP-11 at this time and waiting for the
>>>> calibration to be done immediate after calibration start will
>>>> result in timeout.
>>>>
>>>> This patch splits tegra_mipi_calibrate() and tegra_mipi_wait()
>>>> so triggering for calibration and waiting for it to complete can
>>>> happen at different stages.
>>>>
>>>> Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com>
>>>> ---
>>> ...
>>>> int tegra_mipi_calibrate(struct tegra_mipi_device *device)
>>>> {
>>>> @@ -370,12 +381,10 @@ int tegra_mipi_calibrate(struct
>>>> tegra_mipi_device *device)
>>>> value |= MIPI_CAL_CTRL_START;
>>>> tegra_mipi_writel(device->mipi, value, MIPI_CAL_CTRL);
>>>> - err = tegra_mipi_wait(device->mipi);
>>> Doesn't MIPI clock need to be enabled during of the calibration process?
>> MIPI clock is already enabled in tegra_mipi_calibrate
>>>> mutex_unlock(&device->mipi->lock);
>>>> clk_disable(device->mipi->clk);
> What keeps MIPI clock enabled after completion of the
> tegra_mipi_calibrate() invocation?
MIPI clock is disabled at end of tegra_mipi_calibrate and is re-enabled
during tegra_mipi_wait.
I think I should fix this to keep the clock enabled till calibration
results are latched.
All consumers of tegra_mipi_calibrate() will call tegra_mipi_wait().
So will remove clk_disable mipi clk at end of tegra_mipi_calibrate() and
clk_enable mipi_clk at beginning of tegra_mipi_wait()
>
>>>> - return err;
>>>> + return 0;
>>>> }
>>>> EXPORT_SYMBOL(tegra_mipi_calibrate);
^ permalink raw reply
* Re: [poky] [meta-yocto][dunfell] poky: Add fedora32 as a supported distro
From: Steve Sakoman @ 2020-07-16 22:48 UTC (permalink / raw)
To: akuster808; +Cc: poky
In-Reply-To: <bbfbd6da-0398-8c60-664c-b5bd6c19b06a@gmail.com>
On Thu, Jul 16, 2020 at 12:31 PM akuster808 <akuster808@gmail.com> wrote:
>
> I believe Ubuntu 19.x has been removed from the AB. Not sure if this file need to reflect that or not?
I think not, otherwise users who are currently using Ubuntu 19.x will
get an error when they upgrade to the latest version of dunfell.
Of course things may break on Ubuntu 19.x at some point since we
aren't testing it, but we can deal with that when we get reports.
Steve
Steve
>
> -armin
>
> On 7/16/20 3:11 PM, Steve Sakoman wrote:
>
> Signed-off-by: Steve Sakoman <steve@sakoman.com>
> ---
> meta-poky/conf/distro/poky.conf | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/meta-poky/conf/distro/poky.conf b/meta-poky/conf/distro/poky.conf
> index 7c4a285..7f0a157 100644
> --- a/meta-poky/conf/distro/poky.conf
> +++ b/meta-poky/conf/distro/poky.conf
> @@ -59,6 +59,7 @@ SANITY_TESTED_DISTROS ?= " \
> ubuntu-20.04 \n \
> fedora-30 \n \
> fedora-31 \n \
> + fedora-32 \n \
> centos-7 \n \
> centos-8 \n \
> debian-8 \n \
>
>
>
>
>
^ permalink raw reply
* [PATCH] efi_loader: Correct value for ARM_SMC_MM_RET_NO_MEMORY
From: Heinrich Schuchardt @ 2020-07-16 22:46 UTC (permalink / raw)
To: u-boot
In-Reply-To: <20200716202754.164026-1-ilias.apalodimas@linaro.org>
On 7/16/20 10:27 PM, Ilias Apalodimas wrote:
> Instead of adding the definition for the specific MM SVC used in
> StandAloneMM we added the one used in the standard SMC calls.
> So change the value from -4 to -5 to match the correct one defined in
> EDK2
Please, rename all your MM return code constants to avoid further confusion:
/* MM SVC return error codes */
#define ARM_SVC_SPM_RET_SUCCESS 0
#define ARM_SVC_SPM_RET_NOT_SUPPORTED -1
#define ARM_SVC_SPM_RET_INVALID_PARAMS -2
#define ARM_SVC_SPM_RET_DENIED -3
#define ARM_SVC_SPM_RET_NO_MEMORY -5
Best regards
Heinrich
>
> Fixes 23a397d2e2fb: ("efi_loader: Add headers for EDK2 StandAloneMM communication")
> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> ---
> include/mm_communication.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/mm_communication.h b/include/mm_communication.h
> index 193c4d157874..5aa60160ac63 100644
> --- a/include/mm_communication.h
> +++ b/include/mm_communication.h
> @@ -52,14 +52,14 @@ struct efi_mm_communicate_header {
> #define MM_COMMUNICATE_HEADER_SIZE \
> (sizeof(struct efi_mm_communicate_header))
>
> -/* Defined in EDK2 ArmPkg/Include/IndustryStandard/ArmStdSmc.h */
> +/* Defined in EDK2 ArmPkg/Include/IndustryStandard/ArmMmSvc.h */
>
> /* MM return error codes */
> #define ARM_SMC_MM_RET_SUCCESS 0
> #define ARM_SMC_MM_RET_NOT_SUPPORTED -1
> #define ARM_SMC_MM_RET_INVALID_PARAMS -2
> #define ARM_SMC_MM_RET_DENIED -3
> -#define ARM_SMC_MM_RET_NO_MEMORY -4
> +#define ARM_SMC_MM_RET_NO_MEMORY -5
>
> /* Defined in EDK2 MdeModulePkg/Include/Guid/SmmVariableCommon.h */
>
>
^ permalink raw reply
* Re: [PATCH 8/8] drm/mgag200: Add support for G200 desktop cards
From: Lyude Paul @ 2020-07-16 22:43 UTC (permalink / raw)
To: Thomas Zimmermann, daniel, airlied, sam, emil.velikov, krzk,
john.p.donnelly, rong.a.chen, kraxel, eich, tiwai
Cc: dri-devel
In-Reply-To: <20200715145902.13122-9-tzimmermann@suse.de>
On Wed, 2020-07-15 at 16:59 +0200, Thomas Zimmermann wrote:
> This patch adds support for G200 desktop cards. We can reuse the whole
> memory and modesetting code. A few PCI and DAC register values have to
> be updated accordingly.
>
> The most significant change is in the PLL setup. The get the clock limits
> and reference clocks, parses the device's BIOS. With no BIOS found, safe
> defaults are being used.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Co-developed-by: Egbert Eich <eich@suse.com>
> Signed-off-by: Egbert Eich <eich@suse.com>
> Co-developed-by: Takashi Iwai <tiwai@suse.de>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---
> MAINTAINERS | 2 +-
> drivers/gpu/drm/mgag200/Kconfig | 12 +--
> drivers/gpu/drm/mgag200/mgag200_drv.c | 125 ++++++++++++++++++++++++-
> drivers/gpu/drm/mgag200/mgag200_drv.h | 10 ++
> drivers/gpu/drm/mgag200/mgag200_mode.c | 80 ++++++++++++++++
> 5 files changed, 220 insertions(+), 9 deletions(-)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 415954a98934..4c6f96e2b79b 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -5406,7 +5406,7 @@ S: Orphan / Obsolete
> F: drivers/gpu/drm/mga/
> F: include/uapi/drm/mga_drm.h
>
> -DRM DRIVER FOR MGA G200 SERVER GRAPHICS CHIPS
> +DRM DRIVER FOR MGA G200 GRAPHICS CHIPS
> M: Dave Airlie <airlied@redhat.com>
> S: Odd Fixes
> F: drivers/gpu/drm/mgag200/
> diff --git a/drivers/gpu/drm/mgag200/Kconfig b/drivers/gpu/drm/mgag200/Kconfig
> index 93be766715c9..eec59658a938 100644
> --- a/drivers/gpu/drm/mgag200/Kconfig
> +++ b/drivers/gpu/drm/mgag200/Kconfig
> @@ -1,13 +1,11 @@
> # SPDX-License-Identifier: GPL-2.0-only
> config DRM_MGAG200
> - tristate "Kernel modesetting driver for MGA G200 server engines"
> + tristate "Matrox G200"
> depends on DRM && PCI && MMU
> select DRM_GEM_SHMEM_HELPER
> select DRM_KMS_HELPER
> help
> - This is a KMS driver for the MGA G200 server chips, it
> - does not support the original MGA G200 or any of the desktop
> - chips. It requires 0.3.0 of the modesetting userspace driver,
> - and a version of mga driver that will fail on KMS enabled
> - devices.
> -
> + This is a KMS driver for Matrox G200 chips. It supports the original
> + MGA G200 desktop chips and the server variants. It requires 0.3.0
> + of the modesetting userspace driver, and a version of mga driver
> + that will fail on KMS enabled devices.
> diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c
> b/drivers/gpu/drm/mgag200/mgag200_drv.c
> index f7652e16365c..419817d6e2cd 100644
> --- a/drivers/gpu/drm/mgag200/mgag200_drv.c
> +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c
> @@ -64,6 +64,14 @@ static int mgag200_regs_init(struct mga_device *mdev)
> u8 crtcext3;
>
> switch (mdev->type) {
> + case G200_PCI:
> + case G200_AGP:
> + if (mgag200_has_sgram(mdev))
> + option = 0x4049cd21;
> + else
> + option = 0x40499121;
> + option2 = 0x00008000;
> + break;
> case G200_SE_A:
> case G200_SE_B:
> if (mgag200_has_sgram(mdev))
> @@ -115,6 +123,117 @@ static int mgag200_regs_init(struct mga_device *mdev)
> return 0;
> }
>
> +static void mgag200_g200_interpret_bios(struct mga_device *mdev,
> + unsigned char __iomem *bios,
> + size_t size)
> +{
> + static const unsigned int expected_length[6] = {
> + 0, 64, 64, 64, 128, 128
> + };
> +
> + struct drm_device *dev = &mdev->base;
> + unsigned char __iomem *pins;
huh, never realized you could write directly to unsigned char __iomem pointers!
> + unsigned int pins_len, version;
> + int offset;
> + int tmp;
> +
> + if (size < MGA_BIOS_OFFSET + 1)
> + return;
> +
> + if (bios[45] != 'M' || bios[46] != 'A' || bios[47] != 'T' ||
> + bios[48] != 'R' || bios[49] != 'O' || bios[50] != 'X')
> + return;
> +
> + offset = (bios[MGA_BIOS_OFFSET + 1] << 8) | bios[MGA_BIOS_OFFSET];
> +
> + if (offset + 5 > size)
> + return;
> +
> + pins = bios + offset;
> + if (pins[0] == 0x2e && pins[1] == 0x41) {
> + version = pins[5];
> + pins_len = pins[2];
> + } else {
> + version = 1;
> + pins_len = pins[0] + (pins[1] << 8);
> + }
> +
> + if (version < 1 || version > 5) {
> + drm_warn(dev, "Unknown BIOS PInS version: %d\n", version);
Did you maybe mean pins or PINS here? or is PInS some weird abbreviation matrox
uses?
> + return;
> + }
> + if (pins_len != expected_length[version]) {
> + drm_warn(dev, "Unexpected BIOS PInS size: %d expeced: %d\n",
> + pins_len, expected_length[version]);
> + return;
> + }
> +
> + if (offset + pins_len > size)
> + return;
> +
> + drm_dbg_kms(dev, "MATROX BIOS PInS version %d size: %d found\n",
> + version, pins_len);
> +
> + switch (version) {
> + case 1:
> + tmp = pins[24] + (pins[25] << 8);
> + if (tmp)
> + mdev->model.g200.pclk_max = tmp * 10;
> + break;
> + case 2:
> + if (pins[41] != 0xff)
> + mdev->model.g200.pclk_max = (pins[41] + 100) * 1000;
> + break;
> + case 3:
> + if (pins[36] != 0xff)
> + mdev->model.g200.pclk_max = (pins[36] + 100) * 1000;
> + if (pins[52] & 0x20)
> + mdev->model.g200.ref_clk = 14318;
> + break;
> + case 4:
> + if (pins[39] != 0xff)
> + mdev->model.g200.pclk_max = pins[39] * 4 * 1000;
> + if (pins[92] & 0x01)
> + mdev->model.g200.ref_clk = 14318;
> + break;
> + case 5:
> + tmp = pins[4] ? 8000 : 6000;
> + if (pins[123] != 0xff)
> + mdev->model.g200.pclk_min = pins[123] * tmp;
> + if (pins[38] != 0xff)
> + mdev->model.g200.pclk_max = pins[38] * tmp;
> + if (pins[110] & 0x01)
> + mdev->model.g200.ref_clk = 14318;
> + break;
> + default:
> + break;
> + }
> +}
> +
> +static void mgag200_g200_init_refclk(struct mga_device *mdev)
> +{
> + struct drm_device *dev = &mdev->base;
> + unsigned char __iomem *bios;
> + size_t size;
> +
> + mdev->model.g200.pclk_min = 50000;
> + mdev->model.g200.pclk_max = 230000;
> + mdev->model.g200.ref_clk = 27050;
> +
> + bios = pci_map_rom(dev->pdev, &size);
> + if (!bios)
> + return;
> +
> + if (size != 0 && bios[0] == 0x55 && bios[1] == 0xaa)
> + mgag200_g200_interpret_bios(mdev, bios, size);
> +
> + pci_unmap_rom(dev->pdev, bios);
> +
> + drm_dbg_kms(dev, "pclk_min: %ld pclk_max: %ld ref_clk: %ld\n",
> + mdev->model.g200.pclk_min, mdev->model.g200.pclk_max,
> + mdev->model.g200.ref_clk);
> +}
> +
> static void mgag200_g200se_init_unique_id(struct mga_device *mdev)
> {
> struct drm_device *dev = &mdev->base;
> @@ -138,7 +257,9 @@ static int mgag200_device_init(struct mga_device *mdev,
> unsigned long flags)
> if (ret)
> return ret;
>
> - if (IS_G200_SE(mdev))
> + if (mdev->type == G200_PCI || mdev->type == G200_AGP)
> + mgag200_g200_init_refclk(mdev);
> + else if (IS_G200_SE(mdev))
> mgag200_g200se_init_unique_id(mdev);
>
> ret = mgag200_mm_init(mdev);
> @@ -182,6 +303,8 @@ mgag200_device_create(struct pci_dev *pdev, unsigned long
> flags)
> */
>
> static const struct pci_device_id mgag200_pciidlist[] = {
> + { PCI_VENDOR_ID_MATROX, 0x520, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_PCI },
> + { PCI_VENDOR_ID_MATROX, 0x521, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_AGP },
> { PCI_VENDOR_ID_MATROX, 0x522, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
> G200_SE_A | MGAG200_FLAG_HW_BUG_NO_STARTADD},
> { PCI_VENDOR_ID_MATROX, 0x524, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_SE_B
> },
> diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.h
> b/drivers/gpu/drm/mgag200/mgag200_drv.h
> index 048efe635aff..54061a61e9ca 100644
> --- a/drivers/gpu/drm/mgag200/mgag200_drv.h
> +++ b/drivers/gpu/drm/mgag200/mgag200_drv.h
> @@ -38,6 +38,8 @@
> #define RREG32(reg) ioread32(((void __iomem *)mdev->rmmio) + (reg))
> #define WREG32(reg, v) iowrite32(v, ((void __iomem *)mdev->rmmio) + (reg))
>
> +#define MGA_BIOS_OFFSET 0x7ffc
> +
> #define ATTR_INDEX 0x1fc0
> #define ATTR_DATA 0x1fc1
>
> @@ -129,6 +131,8 @@ struct mga_mc {
> };
>
> enum mga_type {
> + G200_PCI,
> + G200_AGP,
> G200_SE_A,
> G200_SE_B,
> G200_WB,
> @@ -167,12 +171,18 @@ struct mga_device {
> int fb_mtrr;
>
> union {
> + struct {
> + long ref_clk;
> + long pclk_min;
> + long pclk_max;
> + } g200;
> struct {
> /* SE model number stored in reg 0x1e24 */
> u32 unique_rev_id;
> } g200se;
> } model;
>
> +
> struct mga_connector connector;
> struct drm_simple_display_pipe display_pipe;
> };
> diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c
> b/drivers/gpu/drm/mgag200/mgag200_mode.c
> index 752409c7f326..bc11552415f5 100644
> --- a/drivers/gpu/drm/mgag200/mgag200_mode.c
> +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
> @@ -108,6 +108,77 @@ static inline void mga_wait_busy(struct mga_device *mdev)
> } while ((status & 0x01) && time_before(jiffies, timeout));
> }
>
> +/*
> + * PLL setup
> + */
> +
> +static int mgag200_g200_set_plls(struct mga_device *mdev, long clock)
> +{
> + struct drm_device *dev = &mdev->base;
> + const int post_div_max = 7;
> + const int in_div_min = 1;
> + const int in_div_max = 6;
> + const int feed_div_min = 7;
> + const int feed_div_max = 127;
> + u8 testm, testn;
> + u8 n = 0, m = 0, p, s;
> + long f_vco;
> + long computed;
> + long delta, tmp_delta;
> + long ref_clk = mdev->model.g200.ref_clk;
> + long p_clk_min = mdev->model.g200.pclk_min;
> + long p_clk_max = mdev->model.g200.pclk_max;
> +
> + if (clock > p_clk_max) {
> + drm_err(dev, "Pixel Clock %ld too high\n", clock);
> + return 1;
> + }
> +
> + if (clock < p_clk_min >> 3)
Looks like there's a stray space after the <. You could also just use max()
here, but I'll leave that up to you
> + clock = p_clk_min >> 3;
> +
> + f_vco = clock;
> + for (p = 0;
> + p <= post_div_max && f_vco < p_clk_min;
> + p = (p << 1) + 1, f_vco <<= 1)
> + ;
> +
> + delta = clock;
> +
> + for (testm = in_div_min; testm <= in_div_max; testm++) {
> + for (testn = feed_div_min; testn <= feed_div_max; testn++) {
> + computed = ref_clk * (testn + 1) / (testm + 1);
> + if (computed < f_vco)
> + tmp_delta = f_vco - computed;
> + else
> + tmp_delta = computed - f_vco;
Another stray space before the =
With those nitpicks addressed, this series is:
Reviewed-by: Lyude Paul <lyude@redhat.com>
> + if (tmp_delta < delta) {
> + delta = tmp_delta;
> + m = testm;
> + n = testn;
> + }
> + }
> + }
> + f_vco = ref_clk * (n + 1) / (m + 1);
> + if (f_vco < 100000)
> + s = 0;
> + else if (f_vco < 140000)
> + s = 1;
> + else if (f_vco < 180000)
> + s = 2;
> + else
> + s = 3;
> +
> + drm_dbg_kms(dev, "clock: %ld vco: %ld m: %d n: %d p: %d s: %d\n",
> + clock, f_vco, m, n, p, s);
> +
> + WREG_DAC(MGA1064_PIX_PLLC_M, m);
> + WREG_DAC(MGA1064_PIX_PLLC_N, n);
> + WREG_DAC(MGA1064_PIX_PLLC_P, (p | (s << 3)));
> +
> + return 0;
> +}
> +
> #define P_ARRAY_SIZE 9
>
> static int mga_g200se_set_plls(struct mga_device *mdev, long clock)
> @@ -717,6 +788,9 @@ static int mgag200_crtc_set_plls(struct mga_device *mdev,
> long clock)
> u8 misc;
>
> switch(mdev->type) {
> + case G200_PCI:
> + case G200_AGP:
> + return mgag200_g200_set_plls(mdev, clock);
> case G200_SE_A:
> case G200_SE_B:
> return mga_g200se_set_plls(mdev, clock);
> @@ -894,6 +968,12 @@ static void mgag200_set_dac_regs(struct mga_device *mdev)
> };
>
> switch (mdev->type) {
> + case G200_PCI:
> + case G200_AGP:
> + dacvalue[MGA1064_SYS_PLL_M] = 0x04;
> + dacvalue[MGA1064_SYS_PLL_N] = 0x2D;
> + dacvalue[MGA1064_SYS_PLL_P] = 0x19;
> + break;
> case G200_SE_A:
> case G200_SE_B:
> dacvalue[MGA1064_VREF_CTL] = 0x03;
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply
* [Buildroot] [PATCH] package/a10disp: add license file
From: Sergio Prado @ 2020-07-16 22:42 UTC (permalink / raw)
To: buildroot
Also separate the fields in the hash file by two spaces.
Signed-off-by: Sergio Prado <sergio.prado@e-labworks.com>
---
package/a10disp/a10disp.hash | 3 ++-
package/a10disp/a10disp.mk | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/package/a10disp/a10disp.hash b/package/a10disp/a10disp.hash
index f1bddec5dfb9..acaafc3530aa 100644
--- a/package/a10disp/a10disp.hash
+++ b/package/a10disp/a10disp.hash
@@ -1,2 +1,3 @@
# Locally calculated
-sha256 5077405030e8f97a1edd4b86d469466abbc4d32b4a4609e58459347fcd1ba35b a10disp-0.6.1.tar.gz
+sha256 5077405030e8f97a1edd4b86d469466abbc4d32b4a4609e58459347fcd1ba35b a10disp-0.6.1.tar.gz
+sha256 ddf849966f57fee8f9675f5a3c7791353d1cba71695cd58016212fc236bbdbee a10disp.c
diff --git a/package/a10disp/a10disp.mk b/package/a10disp/a10disp.mk
index 4c2ee14e2969..c919202329c4 100644
--- a/package/a10disp/a10disp.mk
+++ b/package/a10disp/a10disp.mk
@@ -7,6 +7,7 @@
A10DISP_VERSION = 0.6.1
A10DISP_SITE = $(call github,hglm,a10disp,v$(A10DISP_VERSION))
A10DISP_LICENSE = MIT
+A10DISP_LICENSE_FILES = a10disp.c
A10DISP_DEPENDENCIES = linux
--
2.17.1
^ permalink raw reply related
* Re: [PATCH] powerpc/64: Fix an out of date comment about MMIO ordering
From: Benjamin Herrenschmidt @ 2020-07-16 22:38 UTC (permalink / raw)
To: Palmer Dabbelt, Will Deacon
Cc: kernel-team, bigeasy, Palmer Dabbelt, linux-kernel, npiggin,
paulus, jniethe5, tglx, msuchanek, linuxppc-dev
In-Reply-To: <20200716193820.1141936-1-palmer@dabbelt.com>
On Thu, 2020-07-16 at 12:38 -0700, Palmer Dabbelt wrote:
> From: Palmer Dabbelt <palmerdabbelt@google.com>
>
> This primitive has been renamed, but because it was spelled incorrectly in the
> first place it must have escaped the fixup patch. As far as I can tell this
> logic is still correct: smp_mb__after_spinlock() uses the default smp_mb()
> implementation, which is "sync" rather than "hwsync" but those are the same
> (though I'm not that familiar with PowerPC).
Typo ? That must be me ... :)
Looks fine. Yes, sync and hwsync are the same (by opposition to lwsync
which is lighter weight and doesn't order cache inhibited).
Cheers,
Ben.
> Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
> ---
> arch/powerpc/kernel/entry_64.S | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
> index b3c9f15089b6..7b38b4daca93 100644
> --- a/arch/powerpc/kernel/entry_64.S
> +++ b/arch/powerpc/kernel/entry_64.S
> @@ -357,7 +357,7 @@ _GLOBAL(_switch)
> * kernel/sched/core.c).
> *
> * Uncacheable stores in the case of involuntary preemption must
> - * be taken care of. The smp_mb__before_spin_lock() in __schedule()
> + * be taken care of. The smp_mb__after_spinlock() in __schedule()
> * is implemented as hwsync on powerpc, which orders MMIO too. So
> * long as there is an hwsync in the context switch path, it will
> * be executed on the source CPU after the task has performed
^ permalink raw reply
* [Intel-gfx] ✓ Fi.CI.BAT: success for Remaining RKL patches (rev7)
From: Patchwork @ 2020-07-16 22:39 UTC (permalink / raw)
To: Matt Roper; +Cc: intel-gfx
In-Reply-To: <20200716220551.2730644-1-matthew.d.roper@intel.com>
[-- Attachment #1.1: Type: text/plain, Size: 7945 bytes --]
== Series Details ==
Series: Remaining RKL patches (rev7)
URL : https://patchwork.freedesktop.org/series/77971/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_8758 -> Patchwork_18197
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18197/index.html
Known issues
------------
Here are the changes found in Patchwork_18197 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_exec_suspend@basic-s0:
- fi-tgl-u2: [PASS][1] -> [FAIL][2] ([i915#1888])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8758/fi-tgl-u2/igt@gem_exec_suspend@basic-s0.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18197/fi-tgl-u2/igt@gem_exec_suspend@basic-s0.html
* igt@i915_pm_rpm@basic-pci-d3-state:
- fi-bsw-kefka: [PASS][3] -> [DMESG-WARN][4] ([i915#1982])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8758/fi-bsw-kefka/igt@i915_pm_rpm@basic-pci-d3-state.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18197/fi-bsw-kefka/igt@i915_pm_rpm@basic-pci-d3-state.html
* igt@kms_busy@basic@flip:
- fi-kbl-x1275: [PASS][5] -> [DMESG-WARN][6] ([i915#62] / [i915#92] / [i915#95])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8758/fi-kbl-x1275/igt@kms_busy@basic@flip.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18197/fi-kbl-x1275/igt@kms_busy@basic@flip.html
* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic:
- fi-tgl-y: [PASS][7] -> [DMESG-WARN][8] ([i915#1982])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8758/fi-tgl-y/igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18197/fi-tgl-y/igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic.html
* igt@kms_flip@basic-flip-vs-wf_vblank@b-edp1:
- fi-icl-u2: [PASS][9] -> [DMESG-WARN][10] ([i915#1982])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8758/fi-icl-u2/igt@kms_flip@basic-flip-vs-wf_vblank@b-edp1.html
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18197/fi-icl-u2/igt@kms_flip@basic-flip-vs-wf_vblank@b-edp1.html
* igt@vgem_basic@dmabuf-fence-before:
- fi-tgl-y: [PASS][11] -> [DMESG-WARN][12] ([i915#402]) +1 similar issue
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8758/fi-tgl-y/igt@vgem_basic@dmabuf-fence-before.html
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18197/fi-tgl-y/igt@vgem_basic@dmabuf-fence-before.html
#### Possible fixes ####
* igt@i915_module_load@reload:
- {fi-tgl-dsi}: [DMESG-WARN][13] ([i915#1982]) -> [PASS][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8758/fi-tgl-dsi/igt@i915_module_load@reload.html
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18197/fi-tgl-dsi/igt@i915_module_load@reload.html
- fi-tgl-u2: [DMESG-WARN][15] ([i915#402]) -> [PASS][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8758/fi-tgl-u2/igt@i915_module_load@reload.html
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18197/fi-tgl-u2/igt@i915_module_load@reload.html
* igt@i915_pm_rpm@module-reload:
- fi-skl-6700k2: [INCOMPLETE][17] ([i915#151]) -> [PASS][18]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8758/fi-skl-6700k2/igt@i915_pm_rpm@module-reload.html
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18197/fi-skl-6700k2/igt@i915_pm_rpm@module-reload.html
* igt@i915_selftest@live@coherency:
- fi-gdg-551: [DMESG-FAIL][19] ([i915#1748]) -> [PASS][20]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8758/fi-gdg-551/igt@i915_selftest@live@coherency.html
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18197/fi-gdg-551/igt@i915_selftest@live@coherency.html
* igt@i915_selftest@live@gt_lrc:
- fi-tgl-u2: [DMESG-FAIL][21] ([i915#1233]) -> [PASS][22]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8758/fi-tgl-u2/igt@i915_selftest@live@gt_lrc.html
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18197/fi-tgl-u2/igt@i915_selftest@live@gt_lrc.html
* igt@vgem_basic@setversion:
- fi-tgl-y: [DMESG-WARN][23] ([i915#402]) -> [PASS][24] +1 similar issue
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8758/fi-tgl-y/igt@vgem_basic@setversion.html
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18197/fi-tgl-y/igt@vgem_basic@setversion.html
* igt@vgem_basic@unload:
- fi-blb-e6850: [INCOMPLETE][25] -> [PASS][26]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8758/fi-blb-e6850/igt@vgem_basic@unload.html
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18197/fi-blb-e6850/igt@vgem_basic@unload.html
#### Warnings ####
* igt@i915_pm_rpm@module-reload:
- fi-kbl-x1275: [SKIP][27] ([fdo#109271]) -> [DMESG-FAIL][28] ([i915#62])
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8758/fi-kbl-x1275/igt@i915_pm_rpm@module-reload.html
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18197/fi-kbl-x1275/igt@i915_pm_rpm@module-reload.html
* igt@kms_cursor_legacy@basic-flip-before-cursor-varying-size:
- fi-kbl-x1275: [DMESG-WARN][29] ([i915#62] / [i915#92]) -> [DMESG-WARN][30] ([i915#62] / [i915#92] / [i915#95]) +3 similar issues
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8758/fi-kbl-x1275/igt@kms_cursor_legacy@basic-flip-before-cursor-varying-size.html
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18197/fi-kbl-x1275/igt@kms_cursor_legacy@basic-flip-before-cursor-varying-size.html
* igt@kms_flip@basic-flip-vs-dpms@a-dp1:
- fi-kbl-x1275: [DMESG-WARN][31] ([i915#62] / [i915#92] / [i915#95]) -> [DMESG-WARN][32] ([i915#62] / [i915#92])
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8758/fi-kbl-x1275/igt@kms_flip@basic-flip-vs-dpms@a-dp1.html
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18197/fi-kbl-x1275/igt@kms_flip@basic-flip-vs-dpms@a-dp1.html
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[i915#1233]: https://gitlab.freedesktop.org/drm/intel/issues/1233
[i915#151]: https://gitlab.freedesktop.org/drm/intel/issues/151
[i915#1748]: https://gitlab.freedesktop.org/drm/intel/issues/1748
[i915#1888]: https://gitlab.freedesktop.org/drm/intel/issues/1888
[i915#1982]: https://gitlab.freedesktop.org/drm/intel/issues/1982
[i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402
[i915#62]: https://gitlab.freedesktop.org/drm/intel/issues/62
[i915#92]: https://gitlab.freedesktop.org/drm/intel/issues/92
[i915#95]: https://gitlab.freedesktop.org/drm/intel/issues/95
Participating hosts (45 -> 40)
------------------------------
Missing (5): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-byt-clapper
Build changes
-------------
* Linux: CI_DRM_8758 -> Patchwork_18197
CI-20190529: 20190529
CI_DRM_8758: b6738761bde03de00a1c84c6a85f9379f53f585c @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5738: bc8b56fe177af34fbde7b96f1f66614a0014c6ef @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_18197: dfcce2d96955e0636baa8270decdc53ec3519ab2 @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
dfcce2d96955 drm/i915/rkl: Add Wa_14011224835 for PHY B initialization
8cfb04468d86 drm/i915/rkl: Handle HTI
31fbc2a9271c drm/i915/rkl: Add DPLL4 support
8954a2f2cf54 drm/i915/rkl: Add initial workarounds
c182e5c80066 drm/i915/rkl: Handle new DPCLKA_CFGCR0 layout
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18197/index.html
[-- Attachment #1.2: Type: text/html, Size: 10016 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply
* [Fuego] UnicodeEncodeError fix (was RE: selftest instructions)
From: Bird, Tim @ 2020-07-16 22:36 UTC (permalink / raw)
To: Laszlo Sitzer, fuego@lists.linuxfoundation.org
> -----Original Message-----
> From: Laszlo Sitzer
>
> Hello!
>
> I am working on updating the Fuego docker image and want to make sure I don't break anything. I notice in Fuego v1.3 a self-test was
> introduced.
>
> I wanted to check if the following sequence is sufficient to test Fuego works correctly:
>
> >>>
> ftc add-nodes -b docker
> ftc add-jobs -b docker -t Functional.fuego_release_test
> ftc run-test -b docker -t Functional.fuego_release_test
> >>>
I know that the UnicodeEncodeError exception that was raised during 'ftc add-nodes -b docker'
was not the real error here. That was an error that was covering up the real error
from Jenkins (which is now fixed with a hardcoded plugin version in the Dockerfile).
However, I have made a patch to work around the UnicodeEncodeError.
It required a bit more work than I expected, and uncovered some controversial decisions
by the python community in the Python 2.X lifecycle.
In any event, I'm inlining the patch below, which is now already committed to the
Fuego master branch. In my testing here, it avoids masking errors from Jenkins.
If someone sees some problem with this, let me know.
Thanks very much to Laszlo Sitzer for bringing this to my attention.
-- Tim
patch follows:
-----------------
From 600c12ffc55137aa31da709cfe3ed95d8853e76c Mon Sep 17 00:00:00 2001
From: Tim Bird <tim.bird@sony.com>
Date: Thu, 16 Jul 2020 13:23:28 -0600
Subject: [PATCH] ftc: handle UnicodeEncodeError from jenkins exceptions
A cascade exception ('UnicodeEncodeError') was preventing
user visibility on errors from the Jenkins server.
Change the error handling so that if we get a UnicodeEncodeError
when trying to convert an exception into a string, we change
the default encoding for python string conversions from 'ascii'
to 'utf8'. A description of the issues is in the comment
in the code.
If feels like a hack, but it gets the job done!
Thanks to Laszlo Sitzer for the bug report.
Signed-off-by: Tim Bird <tim.bird@sony.com>
---
scripts/ftc | 44 ++++++++++++++++++++++++++++++++++++++++----
1 file changed, 40 insertions(+), 4 deletions(-)
diff --git a/scripts/ftc b/scripts/ftc
index 1b8ec02..c5e11ba 100755
--- a/scripts/ftc
+++ b/scripts/ftc
@@ -5278,6 +5278,42 @@ def do_power_control(conf, options, command):
error_out("BOARD_CONTROL value %s is not supported" % board_control)
sys.exit(0)
+# this takes an exception object (e), and formats it as a string
+# safely (handling UnicodeEncode errors), then shows usage help, and
+# exits the program with an error message.
+#
+# Background:
+# python 2.7 uses default encoding of 'ascii'. If e is an exception from
+# the jenkins module, then using str(e) will cause the module to use str()
+# on the error message from the jenkins server. If that message has non-ascii
+# chars (which is not uncommon), then python raises a UnicodeEncodeError
+# exception. I don't want to change the code for the jenkins
+# module, and I have no other way of retrieving the string, which I'd like
+# to print.
+# So, do this hack where we reload sys and change the defaultencoding from
+# 'ascii' to 'utf8'. The function setdefaultencoding() exists in the
+# sys module, but is deleted when it is imported (but not on 'reload').
+# I could have modified /usr/lib/python2.7/site.py inside the container
+# to remove the code that deletes the function. This would have avoided
+# the need to do the 'reload(sys)'.
+# But I decided to limit the scope of this change.
+# Sheesh - what a mess!
+def safe_str_help_and_exit(e, ftc_cmd):
+ try:
+ err_msg = str(e)
+ prefix = ""
+ except UnicodeEncodeError:
+ if sys.version_info[0] < 3:
+ # this reload is hacky and can have bad side effects, but we're on
+ # our way out of the program, so we don't care
+ reload(sys)
+ sys.setdefaultencoding('utf8')
+
+ err_msg = str(e)
+ prefix = "ERROR: Operation '%s' raised exception with string:\n" % ftc_cmd
+ msg = prefix + err_msg + '\n---\n' + command_help[ftc_cmd][1]
+ sys.exit(msg)
+
def main():
# use global module names
global re, time, copy2, subprocess, signal, fcntl, requests, json
@@ -5534,7 +5570,7 @@ def main():
do_add_jobs(conf, options)
except Exception as e:
# this assumes the problem is something with the options
- sys.exit(str(e) + '\n' + command_help['add-jobs'][1])
+ safe_str_help_and_exit(e, 'add-jobs')
if command.startswith("rm-job"):
# removes Jenkins jobs
@@ -5542,7 +5578,7 @@ def main():
try:
do_rm_jobs(conf, options)
except Exception as e:
- sys.exit(str(e) + '\n' + command_help['rm-jobs'][1])
+ safe_str_help_and_exit(e, 'rm-jobs')
if command.startswith("add-node"):
# adds Jenkins nodes
@@ -5550,7 +5586,7 @@ def main():
try:
do_add_nodes(conf, options)
except Exception as e:
- sys.exit(str(e) + '\n' + command_help['add-nodes'][1])
+ safe_str_help_and_exit(e, 'add-nodes')
if command.startswith("rm-node"):
# removes Jenkins nodes
@@ -5558,7 +5594,7 @@ def main():
try:
do_rm_nodes(conf, options)
except Exception as e:
- sys.exit(str(e) + '\n' + command_help['rm-nodes'][1])
+ safe_str_help_and_exit(e, 'rm-nodes')
if command == "list-nodes":
# shows jenkins nodes
--
2.1.4
^ permalink raw reply related
* [PATCH] gcc-10.1: add fix for PR 96130
From: Dmitry Baryshkov @ 2020-07-16 22:36 UTC (permalink / raw)
To: openembedded-core; +Cc: Dmitry Baryshkov
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Fix for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96130 causing ICE
(SegFault) when compiling current Mesa git tree.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
meta/recipes-devtools/gcc/gcc-10.1.inc | 1 +
.../gcc/gcc-10.1/pr96130.patch | 106 ++++++++++++++++++
2 files changed, 107 insertions(+)
create mode 100644 meta/recipes-devtools/gcc/gcc-10.1/pr96130.patch
diff --git a/meta/recipes-devtools/gcc/gcc-10.1.inc b/meta/recipes-devtools/gcc/gcc-10.1.inc
index a3de91a2c6a3..a2dd2ae252a5 100644
--- a/meta/recipes-devtools/gcc/gcc-10.1.inc
+++ b/meta/recipes-devtools/gcc/gcc-10.1.inc
@@ -66,6 +66,7 @@ SRC_URI = "\
file://0036-Enable-CET-in-cross-compiler-if-possible.patch \
file://0037-mingw32-Enable-operation_not_supported.patch \
file://0038-libatomic-Do-not-enforce-march-on-aarch64.patch \
+ file://pr96130.patch \
"
SRC_URI[sha256sum] = "b6898a23844b656f1b68691c5c012036c2e694ac4b53a8918d4712ad876e7ea2"
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/pr96130.patch b/meta/recipes-devtools/gcc/gcc-10.1/pr96130.patch
new file mode 100644
index 000000000000..f0e6f85e22f9
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/pr96130.patch
@@ -0,0 +1,106 @@
+From 0d03c0ee5213703ec6d9ffa632fa5298d83adaaa Mon Sep 17 00:00:00 2001
+From: Jakub Jelinek <jakub@redhat.com>
+Date: Mon, 13 Jul 2020 18:25:53 +0200
+Subject: [PATCH] ipa-fnsummary: Fix ICE with switch predicates [PR96130]
+
+The following testcase ICEs since r10-3199.
+There is a switch with default label, where the controlling expression has
+range just 0..7 and there are case labels for all those 8 values, but
+nothing has yet optimized away the default.
+Since r10-3199, set_switch_stmt_execution_predicate sets the switch to
+default label's edge's predicate to a false predicate and then
+compute_bb_predicates propagates the predicates through the cfg, but false
+predicates aren't really added. The caller of compute_bb_predicates
+in one place handles NULL bb->aux as false predicate:
+ if (fbi.info)
+ {
+ if (bb->aux)
+ bb_predicate = *(predicate *) bb->aux;
+ else
+ bb_predicate = false;
+ }
+ else
+ bb_predicate = true;
+but then in two further spots that the patch below is changing
+it assumes bb->aux must be non-NULL. Those two spots are guarded by a
+condition that is only true if fbi.info is non-NULL, so I think the right
+fix is to treat NULL aux as false predicate in those spots too.
+
+2020-07-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR ipa/96130
+ * ipa-fnsummary.c (analyze_function_body): Treat NULL bb->aux
+ as false predicate.
+
+ * gcc.dg/torture/pr96130.c: New test.
+
+(cherry picked from commit 776e48e0931db69f158f40e5cb8e15463d879a42)
+---
+ gcc/ipa-fnsummary.c | 10 ++++++++--
+ gcc/testsuite/gcc.dg/torture/pr96130.c | 26 ++++++++++++++++++++++++++
+ 2 files changed, 34 insertions(+), 2 deletions(-)
+ create mode 100644 gcc/testsuite/gcc.dg/torture/pr96130.c
+
+diff --git a/gcc/ipa-fnsummary.c b/gcc/ipa-fnsummary.c
+index 045a0ecf766..55a0b272a96 100644
+--- a/gcc/ipa-fnsummary.c
++++ b/gcc/ipa-fnsummary.c
+@@ -2766,7 +2766,10 @@ analyze_function_body (struct cgraph_node *node, bool early)
+ edge ex;
+ unsigned int j;
+ class tree_niter_desc niter_desc;
+- bb_predicate = *(predicate *) loop->header->aux;
++ if (loop->header->aux)
++ bb_predicate = *(predicate *) loop->header->aux;
++ else
++ bb_predicate = false;
+
+ exits = get_loop_exit_edges (loop);
+ FOR_EACH_VEC_ELT (exits, j, ex)
+@@ -2799,7 +2802,10 @@ analyze_function_body (struct cgraph_node *node, bool early)
+ for (unsigned i = 0; i < loop->num_nodes; i++)
+ {
+ gimple_stmt_iterator gsi;
+- bb_predicate = *(predicate *) body[i]->aux;
++ if (body[i]->aux)
++ bb_predicate = *(predicate *) body[i]->aux;
++ else
++ bb_predicate = false;
+ for (gsi = gsi_start_bb (body[i]); !gsi_end_p (gsi);
+ gsi_next (&gsi))
+ {
+diff --git a/gcc/testsuite/gcc.dg/torture/pr96130.c b/gcc/testsuite/gcc.dg/torture/pr96130.c
+new file mode 100644
+index 00000000000..f722b9ad2a9
+--- /dev/null
++++ b/gcc/testsuite/gcc.dg/torture/pr96130.c
+@@ -0,0 +1,26 @@
++/* PR ipa/96130 */
++/* { dg-do compile } */
++
++struct S { unsigned j : 3; };
++int k, l, m;
++
++void
++foo (struct S x)
++{
++ while (l != 5)
++ switch (x.j)
++ {
++ case 1:
++ case 3:
++ case 4:
++ case 6:
++ case 2:
++ case 5:
++ l = m;
++ case 7:
++ case 0:
++ k = 0;
++ default:
++ break;
++ }
++}
+--
+2.18.4
+
--
2.27.0
^ permalink raw reply related
* Re: TB Cache size grows out of control with qemu 5.0
From: BALATON Zoltan @ 2020-07-16 22:35 UTC (permalink / raw)
To: Alex Bennée
Cc: Paolo Bonzini, qemu-devel, Christian Ehrhardt, Richard Henderson
In-Reply-To: <871rlbwhlp.fsf@linaro.org>
[-- Attachment #1: Type: text/plain, Size: 4796 bytes --]
On Thu, 16 Jul 2020, Alex Bennée wrote:
> Christian Ehrhardt <christian.ehrhardt@canonical.com> writes:
>> On Wed, Jul 15, 2020 at 5:58 PM BALATON Zoltan <balaton@eik.bme.hu> wrote:
>>> See commit 47a2def4533a2807e48954abd50b32ecb1aaf29a and the next two
>>> following it.
>>
>> Thank you Zoltan for pointing out this commit, I agree that this seems to be
>> the trigger for the issues I'm seeing. Unfortunately the common CI host size
>> is 1-2G. For example on Ubuntu Autopkgtests 1.5G.
>> Those of them running guests do so in 0.5-1G size in TCG mode
>> (as they often can't rely on having KVM available).
>>
>> The 1G TB buffer + 0.5G actual guest size + lack of dynamic downsizing
>> on memory pressure (never existed) makes these systems go OOM-Killing
>> the qemu process.
>
> Ooops. I admit the assumption was that most people running system
> emulation would be doing it on beefier machines.
>
>> The patches indicated that the TB flushes on a full guest boot are a
>> good indicator of the TB size efficiency. From my old checks I had:
>>
>> - Qemu 4.2 512M guest with 32M default overwritten by ram-size/4
>> TB flush count 14, 14, 16
>> - Qemu 5.0 512M guest with 1G default
>> TB flush count 1, 1, 1
>>
>> I agree that ram/4 seems odd, especially on huge guests that is a lot
>> potentially wasted. And most environments have a bit of breathing
>> room 1G is too big in small host systems and the common CI system falls
>> into this category. So I tuned it down to 256M for a test.
>>
>> - Qemu 4.2 512M guest with tb-size 256M
>> TB flush count 5, 5, 5
>> - Qemu 5.0 512M guest with tb-size 256M
>> TB flush count 5, 5, 5
>> - Qemu 5.0 512M guest with 256M default in code
>> TB flush count 5, 5, 5
>>
>> So performance wise the results are as much in-between as you'd think from a
>> TB size in between. And the memory consumption which (for me) is the actual
>> current issue to fix would be back in line again as expected.
>
> So I'm glad you have the workaround.
>
>>
>> So on one hand I'm suggesting something like:
>> --- a/accel/tcg/translate-all.c
>> +++ b/accel/tcg/translate-all.c
>> @@ -944,7 +944,7 @@ static void page_lock_pair(PageDesc **re
>> * Users running large scale system emulation may want to tweak their
>> * runtime setup via the tb-size control on the command line.
>> */
>> -#define DEFAULT_CODE_GEN_BUFFER_SIZE_1 (1 * GiB)
>> +#define DEFAULT_CODE_GEN_BUFFER_SIZE_1 (256 * MiB)
>
> The problem we have is any number we pick here is arbitrary. And while
> it did regress your use-case changing it again just pushes a performance
> regression onto someone else. The most (*) 64 bit desktop PCs have 16Gb
> of RAM, almost all have more than 8gb. And there is a workaround.
>
> * random number from Steams HW survey.
>
>> #endif
>> #endif
>>
>> OTOH I understand someone else might want to get the more speedy 1G
>> especially for large guests. If someone used to run a 4G guest in TCG the
>> TB Size was 1G all along.
>> How about picking the smaller of (1G || ram-size/4) as default?
>>
>> This might then look like:
>> --- a/accel/tcg/translate-all.c
>> +++ b/accel/tcg/translate-all.c
>> @@ -956,7 +956,12 @@ static inline size_t size_code_gen_buffe
>> {
>> /* Size the buffer. */
>> if (tb_size == 0) {
>> - tb_size = DEFAULT_CODE_GEN_BUFFER_SIZE;
>> + unsigned long max_default = (unsigned long)(ram_size / 4);
>> + if (max_default < DEFAULT_CODE_GEN_BUFFER_SIZE) {
>> + tb_size = max_default;
>> + } else {
>> + tb_size = DEFAULT_CODE_GEN_BUFFER_SIZE;
>> + }
>> }
>> if (tb_size < MIN_CODE_GEN_BUFFER_SIZE) {
>> tb_size = MIN_CODE_GEN_BUFFER_SIZE;
>>
>> This is a bit more tricky than it seems as ram_sizes is no more
>> present in that context but it is enough to discuss it.
>> That should serve all cases - small and large - better as a pure
>> static default of 1G or always ram/4?
>
> I'm definitely against re-introducing ram_size into the mix. The
> original commit (a1b18df9a4) that broke this introduced an ordering
> dependency which we don't want to bring back.
>
> I'd be more amenable to something that took into account host memory and
> limited the default if it was smaller than a threshold. Is there a way
> to probe that that doesn't involve slurping /proc/meminfo?
I agree that this should be dependent on host memory size not guest
ram_size but it might be tricky to get that value because different host
OSes would need different ways. Maybe a new qemu_host_mem_size portability
function will be needed that implements this for different host OSes.
POSIX may or may not have sysconf _SC_PHYS_PAGES and _SC_AVPHYS_PAGES and
linux has sysinfo but don't know how reliable these are.
Regards,
BALATON Zoltan
^ permalink raw reply
* Re: [docs] [PATCH] ref-system-requirements: update supported hosts lists
From: akuster @ 2020-07-16 22:35 UTC (permalink / raw)
To: docs; +Cc: Steve Sakoman
In-Reply-To: <16225C0CF546C9E0.31624@lists.yoctoproject.org>
[-- Attachment #1: Type: text/plain, Size: 1814 bytes --]
Dunfell needs updating too but I am not sure if we can remove hosts that
are no longer in the AB like Ubuntu 19.04 or the Fedora ones.
- armin
On 7/16/20 3:27 PM, akuster via lists.yoctoproject.org wrote:
> drop Ubuntu 19, Fedora 28 & 29
> Add: Fedora 31, 32 , Centos 8 and Ubuntu 20
>
> Signed-off-by: Armin Kuster <akuster808@gmail.com>
> ---
> documentation/ref-manual/ref-system-requirements.xml | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/documentation/ref-manual/ref-system-requirements.xml b/documentation/ref-manual/ref-system-requirements.xml
> index 43e217c6d..ac8b0032d 100644
> --- a/documentation/ref-manual/ref-system-requirements.xml
> +++ b/documentation/ref-manual/ref-system-requirements.xml
> @@ -94,11 +94,12 @@
> <itemizedlist>
> <listitem><para>Ubuntu 16.04 (LTS)</para></listitem>
> <listitem><para>Ubuntu 18.04 (LTS)</para></listitem>
> - <listitem><para>Ubuntu 19.04</para></listitem>
> - <listitem><para>Fedora 28</para></listitem>
> - <listitem><para>Fedora 29</para></listitem>
> + <listitem><para>Ubuntu 20.04</para></listitem>
> <listitem><para>Fedora 30</para></listitem>
> + <listitem><para>Fedora 31</para></listitem>
> + <listitem><para>Fedora 32</para></listitem>
> <listitem><para>CentOS 7.x</para></listitem>
> + <listitem><para>CentOS 8.x</para></listitem>
> <listitem><para>Debian GNU/Linux 8.x (Jessie)</para></listitem>
> <listitem><para>Debian GNU/Linux 9.x (Stretch)</para></listitem>
> <listitem><para>Debian GNU/Linux 10.x (Buster)</para></listitem>
>
>
[-- Attachment #2: Type: text/html, Size: 2692 bytes --]
^ permalink raw reply
* Re: [poky] [meta-yocto][dunfell] poky: Add fedora32 as a supported distro
From: akuster @ 2020-07-16 22:31 UTC (permalink / raw)
To: Steve Sakoman, poky
In-Reply-To: <aff81f13dec648e6546b0ec2887c55c49fdacb7f.1594937430.git.steve@sakoman.com>
[-- Attachment #1: Type: text/plain, Size: 771 bytes --]
I believe Ubuntu 19.x has been removed from the AB. Not sure if this
file need to reflect that or not?
-armin
On 7/16/20 3:11 PM, Steve Sakoman wrote:
> Signed-off-by: Steve Sakoman <steve@sakoman.com>
> ---
> meta-poky/conf/distro/poky.conf | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/meta-poky/conf/distro/poky.conf b/meta-poky/conf/distro/poky.conf
> index 7c4a285..7f0a157 100644
> --- a/meta-poky/conf/distro/poky.conf
> +++ b/meta-poky/conf/distro/poky.conf
> @@ -59,6 +59,7 @@ SANITY_TESTED_DISTROS ?= " \
> ubuntu-20.04 \n \
> fedora-30 \n \
> fedora-31 \n \
> + fedora-32 \n \
> centos-7 \n \
> centos-8 \n \
> debian-8 \n \
>
>
[-- Attachment #2: Type: text/html, Size: 1343 bytes --]
^ permalink raw reply
* Re: [PATCH] ASoC: soc-jack: calling snd_soc_jack_report causes a null pointer access
From: Mark Brown @ 2020-07-16 22:29 UTC (permalink / raw)
To: mnlife qiao; +Cc: open list, alsa-devel, lgirdwood, mnlife
In-Reply-To: <CAGjHXR2ExzMO3ntwzZy9QUhpuqe-VZAXOucNkXXZK+0XZcaQWQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 654 bytes --]
On Wed, Jul 15, 2020 at 08:24:04AM +0800, mnlife qiao wrote:
> When snd_soc_card_jack_new is not called or the call fails,
> calling this function causes a null pointer access
> --- a/sound/soc/soc-jack.c
> +++ b/sound/soc/soc-jack.c
> @@ -44,7 +44,7 @@ void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask)
> unsigned int sync = 0;
> int enable;
>
> - if (!jack)
> + if (!jack || !jack->jack)
> return;
I'm afraid this still won't apply - there's a text/html version of the
patch, in the text portion tabs have been converted into spaces and it
appears some other issues that mean git am can't understand it.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply
* Re: [PATCH v2] binder: Don't use mmput() from shrinker function.
From: Tetsuo Handa @ 2020-07-16 22:27 UTC (permalink / raw)
To: Christian Brauner
Cc: Michal Hocko, Greg Kroah-Hartman, Arve Hjonnevag, Todd Kjos,
Martijn Coenen, Joel Fernandes, Christian Brauner, syzbot, acme,
alexander.shishkin, jolsa, linux-kernel, mark.rutland, mingo,
namhyung, peterz, syzkaller-bugs, open list:ANDROID DRIVERS,
linux-mm
In-Reply-To: <20200716162931.g3delsp7qmfjup6x@wittgenstein>
On 2020/07/17 1:29, Christian Brauner wrote:
> Does this need a Cc: stable?
Up to someone who applies this patch. I think this race is hard to hit.
^ permalink raw reply
* [PATCH] ref-system-requirements: update supported hosts lists
From: akuster @ 2020-07-16 22:27 UTC (permalink / raw)
To: docs
drop Ubuntu 19, Fedora 28 & 29
Add: Fedora 31, 32 , Centos 8 and Ubuntu 20
Signed-off-by: Armin Kuster <akuster808@gmail.com>
---
documentation/ref-manual/ref-system-requirements.xml | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/documentation/ref-manual/ref-system-requirements.xml b/documentation/ref-manual/ref-system-requirements.xml
index 43e217c6d..ac8b0032d 100644
--- a/documentation/ref-manual/ref-system-requirements.xml
+++ b/documentation/ref-manual/ref-system-requirements.xml
@@ -94,11 +94,12 @@
<itemizedlist>
<listitem><para>Ubuntu 16.04 (LTS)</para></listitem>
<listitem><para>Ubuntu 18.04 (LTS)</para></listitem>
- <listitem><para>Ubuntu 19.04</para></listitem>
- <listitem><para>Fedora 28</para></listitem>
- <listitem><para>Fedora 29</para></listitem>
+ <listitem><para>Ubuntu 20.04</para></listitem>
<listitem><para>Fedora 30</para></listitem>
+ <listitem><para>Fedora 31</para></listitem>
+ <listitem><para>Fedora 32</para></listitem>
<listitem><para>CentOS 7.x</para></listitem>
+ <listitem><para>CentOS 8.x</para></listitem>
<listitem><para>Debian GNU/Linux 8.x (Jessie)</para></listitem>
<listitem><para>Debian GNU/Linux 9.x (Stretch)</para></listitem>
<listitem><para>Debian GNU/Linux 10.x (Buster)</para></listitem>
--
2.17.1
^ permalink raw reply related
* Re: [GIT PULL] I2C updates
From: Corey Minyard @ 2020-07-16 22:26 UTC (permalink / raw)
To: Peter Maydell; +Cc: QEMU Developers
In-Reply-To: <CAFEAcA-UWJBpM_-G2RAe9B-WcPzBaKGZTas1njehQ7gcjsMpew@mail.gmail.com>
On Thu, Jul 16, 2020 at 09:45:41PM +0100, Peter Maydell wrote:
> On Thu, 16 Jul 2020 at 18:49, Corey Minyard <minyard@acm.org> wrote:
> >
> > The following changes since commit 45db94cc90c286a9965a285ba19450f448760a09:
> >
> > Merge remote-tracking branch 'remotes/mcayland/tags/qemu-openbios-20200707' into staging (2020-07-10 16:43:40 +0100)
> >
> > are available in the Git repository at:
> >
> > https://github.com/cminyard/qemu.git tags/for-qemu-i2c-5
> >
> > for you to fetch changes up to 73d5f22ecbb76dfc785876779d47787084ff0f42:
> >
> > hw/i2c: Document the I2C qdev helpers (2020-07-16 12:30:54 -0500)
> >
> > ----------------------------------------------------------------
> > Minor changes to:
> >
> > Add an SMBus config entry
> >
> > Cleanup/simplify/document some I2C interfaces
> >
> > ----------------------------------------------------------------
> > Philippe Mathieu-Daudé (6):
> > hw/i2c/Kconfig: Add an entry for the SMBus
> > hw/i2c/aspeed_i2c: Simplify aspeed_i2c_get_bus()
> > hw/i2c: Rename i2c_try_create_slave() as i2c_slave_new()
> > hw/i2c: Rename i2c_realize_and_unref() as i2c_slave_realize_and_unref()
> > hw/i2c: Rename i2c_create_slave() as i2c_slave_create_simple()
> > hw/i2c: Document the I2C qdev helpers
>
> Hi; this failed to build on x86-64 Linux (incremental build):
Hmm, I did test this, and I just rebuilt, then rebased on the end of
master and rebuilt, without issue.
It looks like the smbus code is not being included, but I don't see how
that can be.
-corey
>
> LINK i386-softmmu/qemu-system-i386
> ../hw/i2c/smbus_eeprom.o: In function `smbus_eeprom_vmstate_needed':
> /home/petmay01/linaro/qemu-for-merges/hw/i2c/smbus_eeprom.c:94:
> undefined reference to `smbus_vmstate_needed'
> ../hw/i2c/smbus_eeprom.o:(.data.rel+0x50): undefined reference to
> `vmstate_smbus_device'
> ../hw/i2c/pm_smbus.o: In function `smb_transaction':
> /home/petmay01/linaro/qemu-for-merges/hw/i2c/pm_smbus.c:93: undefined
> reference to `smbus_quick_command'
> /home/petmay01/linaro/qemu-for-merges/hw/i2c/pm_smbus.c:97: undefined
> reference to `smbus_receive_byte'
> /home/petmay01/linaro/qemu-for-merges/hw/i2c/pm_smbus.c:100: undefined
> reference to `smbus_send_byte'
> /home/petmay01/linaro/qemu-for-merges/hw/i2c/pm_smbus.c:105: undefined
> reference to `smbus_read_byte'
> /home/petmay01/linaro/qemu-for-merges/hw/i2c/pm_smbus.c:108: undefined
> reference to `smbus_write_byte'
> /home/petmay01/linaro/qemu-for-merges/hw/i2c/pm_smbus.c:114: undefined
> reference to `smbus_read_word'
> /home/petmay01/linaro/qemu-for-merges/hw/i2c/pm_smbus.c:117: undefined
> reference to `smbus_write_word'
> /home/petmay01/linaro/qemu-for-merges/hw/i2c/pm_smbus.c:149: undefined
> reference to `smbus_read_block'
> /home/petmay01/linaro/qemu-for-merges/hw/i2c/pm_smbus.c:174: undefined
> reference to `smbus_write_block'
> ../hw/i2c/pm_smbus.o: In function `smb_ioport_writeb':
> /home/petmay01/linaro/qemu-for-merges/hw/i2c/pm_smbus.c:290: undefined
> reference to `smbus_write_block'
> ../hw/ipmi/smbus_ipmi.o:(.data.rel+0x50): undefined reference to
> `vmstate_smbus_device'
> collect2: error: ld returned 1 exit status
>
> (similarly for other qemu-system-* binary links)
>
> thanks
> -- PMM
^ permalink raw reply
* Re: [PATCH] mm: mmap: Merge vma after call_mmap() if possible
From: Andrew Morton @ 2020-07-16 22:24 UTC (permalink / raw)
To: linmiaohe; +Cc: linux-mm, linux-kernel
In-Reply-To: <1594696064-1409-1-git-send-email-linmiaohe@huawei.com>
On Tue, 14 Jul 2020 11:07:44 +0800 linmiaohe <linmiaohe@huawei.com> wrote:
> From: Miaohe Lin <linmiaohe@huawei.com>
>
> The vm_flags may be changed after call_mmap() because drivers may set some
> flags for their own purpose. As a result, we failed to merge the adjacent
> vma due to the different vm_flags as userspace can't pass in the same one.
> Try to merge vma after call_mmap() to fix this issue.
>
> Signed-off-by: Hongxiang Lou <louhongxiang@huawei.com>
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
> mm/mmap.c | 17 ++++++++++++++++-
> 1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 59a4682ebf3f..9568117471f8 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -1689,7 +1689,7 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
> struct list_head *uf)
> {
> struct mm_struct *mm = current->mm;
> - struct vm_area_struct *vma, *prev;
> + struct vm_area_struct *vma, *prev, *merge;
> int error;
> struct rb_node **rb_link, *rb_parent;
> unsigned long charged = 0;
> @@ -1773,6 +1773,20 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
> if (error)
> goto unmap_and_free_vma;
>
> + /* If vm_flags changed after call_mmap(), we should try merge vma again
> + * as we may succeed this time.
> + */
> + if (unlikely(vm_flags != vma->vm_flags && prev)) {
> + merge = vma_merge(mm, prev, vma->vm_start, vma->vm_end, vma->vm_flags,
> + NULL, vma->vm_file, vma->vm_pgoff, NULL, NULL_VM_UFFD_CTX);
> + if (merge) {
> + fput(file);
> + vm_area_free(vma);
> + vma = merge;
> + goto unmap_writable;
Shouldn't we update local variable `vm_flags' here, to pick up the
change? And possibly `addr'?
> + }
> + }
> +
> /* Can addr have changed??
> *
> * Answer: Yes, several device drivers can do it in their
> @@ -1795,6 +1809,7 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
> vma_link(mm, vma, prev, rb_link, rb_parent);
> /* Once vma denies write, undo our temporary denial count */
> if (file) {
> +unmap_writable:
> if (vm_flags & VM_SHARED)
> mapping_unmap_writable(file->f_mapping);
> if (vm_flags & VM_DENYWRITE)
^ permalink raw reply
* Re: [dpdk-dev] [PATCH] lib/librte_eal/common/rte_malloc: remove redundant check for size and alignment
From: Lukasz Wojciechowski @ 2020-07-16 22:23 UTC (permalink / raw)
To: Sarosh Arif, anatoly.burakov; +Cc: dev
In-Reply-To: <20200715133136.31986-1-sarosh.arif@emumba.com>
W dniu 15.07.2020 o 15:31, Sarosh Arif pisze:
> Since mallock_socket() always calls malloc_heap_alloc() and
> this check is present inside malloc_heap_alloc() so there is
> no need to place it in mallock_socket().
>
> Signed-off-by: Sarosh Arif <sarosh.arif@emumba.com>
> ---
> lib/librte_eal/common/rte_malloc.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/lib/librte_eal/common/rte_malloc.c b/lib/librte_eal/common/rte_malloc.c
> index 9d39e58c0..51256117b 100644
> --- a/lib/librte_eal/common/rte_malloc.c
> +++ b/lib/librte_eal/common/rte_malloc.c
> @@ -61,10 +61,6 @@ malloc_socket(const char *type, size_t size, unsigned int align,
> {
> void *ptr;
>
> - /* return NULL if size is 0 or alignment is not power-of-2 */
> - if (size == 0 || (align && !rte_is_power_of_2(align)))
> - return NULL;
> -
> /* if there are no hugepages and if we are not allocating from an
> * external heap, use memory from any socket available. checking for
> * socket being external may return -1 in case of invalid socket, but
Yes the check is duplicated.
However it allows to avoid many unnecessary operations that can cost a
lot, e.g. locking memory inside rte_malloc_heap_socket_is_external().
I would keep it.
Please also note, that the checks are not quite the same as the
malloc_heap_alloc is called with changed align value (align == 0 ? 1 :
align):
ptr = malloc_heap_alloc(type, size, socket_arg, 0, align == 0 ?
1 : align, 0, false);
Although there should be no change in check behavior as for both align
==0 and align == 1 the check will fail and won't be the cause of
returning NULL.
--
Lukasz Wojciechowski
Principal Software Engineer
Samsung R&D Institute Poland
Samsung Electronics
Office +48 22 377 88 25
l.wojciechow@partner.samsung.com
^ permalink raw reply
* Re: sysbus_create_simple Vs qdev_create
From: Eduardo Habkost @ 2020-07-16 22:21 UTC (permalink / raw)
To: Markus Armbruster
Cc: Paolo Bonzini, Daniel P. Berrangé,
Philippe Mathieu-Daudé, qemu-devel, Pratik Parvati
In-Reply-To: <87lfjkvo81.fsf@dusky.pond.sub.org>
On Wed, Jul 15, 2020 at 04:37:18PM +0200, Markus Armbruster wrote:
> Pratik Parvati <pratikp@vayavyalabs.com> writes:
>
> > Hi Markus and Philippe,
> >
> > Thanks for your reply. Now I am pretty clear about Qdev and sysbus helper
> > function.
> >
> > Can you please explain to me in brief on buses and device hierarchies (i.e.
> > BusState and DeviceState) and how they are related to each other? As I can
> > see, the DeviceState class inherits the BusState
> >
> > struct DeviceState {
> > /*< private >*/
> > Object parent_obj;
> > /*< public >*/
> >
> > const char *id;
> > char *canonical_path;
> > bool realized;
> > bool pending_deleted_event;
> > QemuOpts *opts;
> > int hotplugged;
> > bool allow_unplug_during_migration;
> > BusState *parent_bus; \\ BusState is inherited here
> > QLIST_HEAD(, NamedGPIOList) gpios;
> > QLIST_HEAD(, BusState) child_bus;
> > int num_child_bus;
> > int instance_id_alias;
> > int alias_required_for_version;
> > ResettableState reset;
> > };
> >
> > and BusState, in turn, inherits the DeviceState as
> >
> > /**
> > * BusState:
> > * @hotplug_handler: link to a hotplug handler associated with bus.
> > * @reset: ResettableState for the bus; handled by Resettable interface.
> > */struct BusState {
> > Object obj;
> > DeviceState *parent; \\ DeviceState is inherited here
> > char *name;
> > HotplugHandler *hotplug_handler;
> > int max_index;
> > bool realized;
> > int num_children;
> > QTAILQ_HEAD(, BusChild) children;
> > QLIST_ENTRY(BusState) sibling;
> > ResettableState reset;
> > };
> >
> > I am a bit confused. Can you brief me this relation!
>
> We sorely lack introductory documentation on both qdev and QOM. I
> believe most developers are more or less confused about them most of the
> time. I've done a bit of work on both, so I'm probably less confused
> than average. I'm cc'ing maintainers in the hope of reducing average
> confusion among participants in this thread.
>
> DeviceState does not inherit from BusState, and BusState does not
> inherit from DeviceState. The relation you marked in the code is
> actually "has a".
>
> A DeviceState may have a BusState, namely the bus the device is plugged
> into. "May", because some devices are bus-less (their
> DEVICE_GET_CLASS(dev)->bus_type is null), and the others get plugged
> into their bus only at realize time.
>
> Example: PCI device "pci-serial" plugs into a PCI bus.
>
> Example: device "serial" does not plug into a bus (its used as component
> device of "pci-serial" and other devices).
>
> Example: device "pc-dimm" does not plug into a bus.
>
> A bus has a DeviceState, namely the device providing this bus.
>
> Example: device "i440FX-pcihost" provides PCI bus "pci.0".
>
> Both DeviceState and BusState are QOM subtypes of Object. I prefer to
> avoid use of "inherit" for that, because it can mean different things to
> different people.
I'd also note that the use of "parent" in the code is also
ambiguous. It can mean:
* QOM parent type, i.e. TypeInfo.parent. Related fields:
* parent_class members of class structs
* parent_obj members of object structs
* QOM composition tree parent object, i.e. Object::parent
* qdev device parent bus, i.e. DeviceState::parent_bus
* parent device of of qdev bus, i.e. BusState::parent
--
Eduardo
^ permalink raw reply
* [PATCH 1/1] test/dm: check if devices exist
From: Heinrich Schuchardt @ 2020-07-16 22:20 UTC (permalink / raw)
To: u-boot
Running 'ut dm' on the sandbox without -D or -d results in segmentation
faults due to NULL pointer dereferences.
Check that device pointers are non-NULL before using them.
Use ut_assertnonnull() for pointers instead of ut_assert().
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
test/dm/acpi.c | 3 +++
test/dm/core.c | 10 +++++-----
test/dm/devres.c | 1 +
test/dm/test-fdt.c | 2 ++
test/dm/virtio.c | 7 +++++++
5 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/test/dm/acpi.c b/test/dm/acpi.c
index 4c46dd83a6..ece7993cf3 100644
--- a/test/dm/acpi.c
+++ b/test/dm/acpi.c
@@ -96,7 +96,10 @@ DM_TEST(dm_test_acpi_get_table_revision,
static int dm_test_acpi_create_dmar(struct unit_test_state *uts)
{
struct acpi_dmar dmar;
+ struct udevice *cpu;
+ ut_assertok(uclass_first_device(UCLASS_CPU, &cpu));
+ ut_assertnonnull(cpu);
ut_assertok(acpi_create_dmar(&dmar, DMAR_INTR_REMAP));
ut_asserteq(DMAR_INTR_REMAP, dmar.flags);
ut_asserteq(32 - 1, dmar.host_address_width);
diff --git a/test/dm/core.c b/test/dm/core.c
index 6a930ae31a..d20c48443f 100644
--- a/test/dm/core.c
+++ b/test/dm/core.c
@@ -158,7 +158,7 @@ static int dm_test_autobind_uclass_pdata_alloc(struct unit_test_state *uts)
for (uclass_find_first_device(UCLASS_TEST, &dev);
dev;
uclass_find_next_device(&dev)) {
- ut_assert(dev);
+ ut_assertnonnull(dev);
uc_pdata = dev_get_uclass_platdata(dev);
ut_assert(uc_pdata);
@@ -181,7 +181,7 @@ static int dm_test_autobind_uclass_pdata_valid(struct unit_test_state *uts)
for (uclass_find_first_device(UCLASS_TEST, &dev);
dev;
uclass_find_next_device(&dev)) {
- ut_assert(dev);
+ ut_assertnonnull(dev);
uc_pdata = dev_get_uclass_platdata(dev);
ut_assert(uc_pdata);
@@ -747,11 +747,11 @@ static int dm_test_uclass_devices_find(struct unit_test_state *uts)
dev;
ret = uclass_find_next_device(&dev)) {
ut_assert(!ret);
- ut_assert(dev);
+ ut_assertnonnull(dev);
}
ut_assertok(uclass_find_first_device(UCLASS_TEST_DUMMY, &dev));
- ut_assert(!dev);
+ ut_assertnull(dev);
return 0;
}
@@ -778,7 +778,7 @@ static int dm_test_uclass_devices_find_by_name(struct unit_test_state *uts)
testdev;
ret = uclass_find_next_device(&testdev)) {
ut_assertok(ret);
- ut_assert(testdev);
+ ut_assertnonnull(testdev);
findret = uclass_find_device_by_name(UCLASS_TEST_FDT,
testdev->name,
diff --git a/test/dm/devres.c b/test/dm/devres.c
index b5de0cb191..550787495d 100644
--- a/test/dm/devres.c
+++ b/test/dm/devres.c
@@ -153,6 +153,7 @@ static int dm_test_devres_phase(struct unit_test_state *uts)
* allocation created in the bind() method.
*/
ut_assertok(uclass_find_first_device(UCLASS_TEST_DEVRES, &dev));
+ ut_assertnonnull(dev);
devres_get_stats(dev, &stats);
ut_asserteq(1, stats.allocs);
ut_asserteq(TEST_DEVRES_SIZE, stats.total_size);
diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c
index 51f2547409..8ef7c7a88e 100644
--- a/test/dm/test-fdt.c
+++ b/test/dm/test-fdt.c
@@ -832,10 +832,12 @@ static int dm_test_fdt_phandle(struct unit_test_state *uts)
struct udevice *back, *dev, *dev2;
ut_assertok(uclass_find_first_device(UCLASS_PANEL_BACKLIGHT, &back));
+ ut_assertnonnull(back);
ut_asserteq(-ENOENT, uclass_find_device_by_phandle(UCLASS_REGULATOR,
back, "missing", &dev));
ut_assertok(uclass_find_device_by_phandle(UCLASS_REGULATOR, back,
"power-supply", &dev));
+ ut_assertnonnull(dev);
ut_asserteq(0, device_active(dev));
ut_asserteq_str("ldo1", dev->name);
ut_assertok(uclass_get_device_by_phandle(UCLASS_REGULATOR, back,
diff --git a/test/dm/virtio.c b/test/dm/virtio.c
index 4b317d2ec3..4a0c0b23b8 100644
--- a/test/dm/virtio.c
+++ b/test/dm/virtio.c
@@ -22,9 +22,11 @@ static int dm_test_virtio_base(struct unit_test_state *uts)
/* check probe success */
ut_assertok(uclass_first_device(UCLASS_VIRTIO, &bus));
+ ut_assertnonnull(bus);
/* check the child virtio-blk device is bound */
ut_assertok(device_find_first_child(bus, &dev));
+ ut_assertnonnull(dev);
ut_assertok(strcmp(dev->name, "virtio-blk#0"));
/* check driver status */
@@ -49,15 +51,18 @@ static int dm_test_virtio_all_ops(struct unit_test_state *uts)
/* check probe success */
ut_assertok(uclass_first_device(UCLASS_VIRTIO, &bus));
+ ut_assertnonnull(bus);
/* check the child virtio-blk device is bound */
ut_assertok(device_find_first_child(bus, &dev));
+ ut_assertnonnull(dev);
/*
* fake the virtio device probe by filling in uc_priv->vdev
* which is used by virtio_find_vqs/virtio_del_vqs.
*/
uc_priv = dev_get_uclass_priv(bus);
+ ut_assertnonnull(uc_priv);
uc_priv->vdev = dev;
/* test virtio_xxx APIs */
@@ -106,9 +111,11 @@ static int dm_test_virtio_remove(struct unit_test_state *uts)
/* check probe success */
ut_assertok(uclass_first_device(UCLASS_VIRTIO, &bus));
+ ut_assertnonnull(bus);
/* check the child virtio-blk device is bound */
ut_assertok(device_find_first_child(bus, &dev));
+ ut_assertnonnull(dev);
/* set driver status to VIRTIO_CONFIG_S_DRIVER_OK */
ut_assertok(virtio_set_status(dev, VIRTIO_CONFIG_S_DRIVER_OK));
--
2.27.0
^ permalink raw reply related
* Re: [PATCH v2 1/3] module: Rename module_alloc() to text_alloc() and move to kernel proper
From: Christophe Leroy @ 2020-07-16 16:49 UTC (permalink / raw)
To: Jarkko Sakkinen
Cc: Catalin Marinas, Kefeng Wang, Paul Mackerras, Zong Li, Andi Kleen,
Paul Burton, Vincent Whitchurch, Petr Mladek, Brian Gerst,
Andy Lutomirski, Thomas Gleixner, Jiri Kosina, Anup Patel,
linux-kernel, Philipp Rudo, Torsten Duwe, Masami Hiramatsu,
Andrew Morton, Mark Rutland, James E.J. Bottomley, Vincent Chen,
Omar Sandoval, open list:S390, Joe Lawrence, Helge Deller,
John Fastabend, Anil S Keshavamurthy, Yonghong Song, Iurii Zaikin,
Andrii Nakryiko, Thomas Huth, Vasily Gorbik,
moderated list:ARM PORT, Daniel Axtens, Damien Le Moal,
Martin KaFai Lau, Song Liu, Josh Poimboeuf, Heiko Carstens,
Alexei Starovoitov, Atish Patra, Will Deacon, Daniel Borkmann,
Masahiro Yamada, Nayna Jain, Ley Foon Tan, Christian Borntraeger,
Sami Tolvanen, Naveen N. Rao, Mao Han, Marco Elver,
Steven Rostedt, Babu Moger, Borislav Petkov, Greentime Hu,
Ben Dooks, Guan Xuetao, Thomas Bogendoerfer,
open list:PARISC ARCHITECTURE, Jessica Yu,
open list:BPF JIT for MIPS 32-BIT AND 64-BIT, David S. Miller,
Thiago Jung Bauermann, Peter Zijlstra, David Howells,
Amit Daniel Kachhap, Sandipan Das, H. Peter Anvin,
open list:SPARC + UltraSPARC sparc/sparc64, Tiezhu Yang,
Miroslav Benes, Sven Schnelle, Ard Biesheuvel, Vincenzo Frascino,
Anders Roxell, Jiri Olsa,
maintainer:X86 ARCHITECTURE 32-BIT AND 64-BIT, Russell King,
open list:RISC-V ARCHITECTURE, Mike Rapoport, Ingo Molnar,
Albert Ou, Paul E. McKenney, Paul Walmsley, KP Singh,
Dmitry Vyukov, Nick Hu,
open list:BPF JIT for MIPS 32-BIT AND 64-BIT, open list:MIPS,
Palmer Dabbelt, open list:LINUX FOR POWERPC 32-BIT AND 64-BIT
In-Reply-To: <20200714094625.1443261-2-jarkko.sakkinen@linux.intel.com>
Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> a écrit :
> Rename module_alloc() to text_alloc() and module_memfree() to
> text_memfree(), and move them to kernel/text.c, which is unconditionally
> compiled to the kernel proper. This allows kprobes, ftrace and bpf to
> allocate space for executable code without requiring to compile the modules
> support (CONFIG_MODULES=y) in.
You are not changing enough in powerpc to have this work.
On powerpc 32 bits (6xx), when STRICT_KERNEL_RWX is selected, the
vmalloc space is set to NX (no exec) at segment level (ie by 256Mbytes
zone) unless CONFIG_MODULES is selected.
Christophe
>
> Cc: Andi Kleen <ak@linux.intel.com>
> Suggested-by: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> ---
> arch/arm/kernel/Makefile | 3 +-
> arch/arm/kernel/module.c | 21 -----------
> arch/arm/kernel/text.c | 33 ++++++++++++++++++
> arch/arm64/kernel/Makefile | 2 +-
> arch/arm64/kernel/module.c | 42 ----------------------
> arch/arm64/kernel/text.c | 54 ++++++++++++++++++++++++++++
> arch/mips/kernel/Makefile | 2 +-
> arch/mips/kernel/module.c | 9 -----
> arch/mips/kernel/text.c | 19 ++++++++++
> arch/mips/net/bpf_jit.c | 4 +--
> arch/nds32/kernel/Makefile | 2 +-
> arch/nds32/kernel/module.c | 7 ----
> arch/nds32/kernel/text.c | 12 +++++++
> arch/nios2/kernel/Makefile | 1 +
> arch/nios2/kernel/module.c | 19 ----------
> arch/nios2/kernel/text.c | 34 ++++++++++++++++++
> arch/parisc/kernel/Makefile | 2 +-
> arch/parisc/kernel/module.c | 11 ------
> arch/parisc/kernel/text.c | 22 ++++++++++++
> arch/powerpc/net/bpf_jit_comp.c | 4 +--
> arch/riscv/kernel/Makefile | 1 +
> arch/riscv/kernel/module.c | 12 -------
> arch/riscv/kernel/text.c | 20 +++++++++++
> arch/s390/kernel/Makefile | 2 +-
> arch/s390/kernel/ftrace.c | 2 +-
> arch/s390/kernel/module.c | 16 ---------
> arch/s390/kernel/text.c | 23 ++++++++++++
> arch/sparc/kernel/Makefile | 1 +
> arch/sparc/kernel/module.c | 30 ----------------
> arch/sparc/kernel/text.c | 39 +++++++++++++++++++++
> arch/sparc/net/bpf_jit_comp_32.c | 6 ++--
> arch/unicore32/kernel/Makefile | 1 +
> arch/unicore32/kernel/module.c | 7 ----
> arch/unicore32/kernel/text.c | 18 ++++++++++
> arch/x86/kernel/Makefile | 1 +
> arch/x86/kernel/ftrace.c | 4 +--
> arch/x86/kernel/kprobes/core.c | 4 +--
> arch/x86/kernel/module.c | 49 --------------------------
> arch/x86/kernel/text.c | 60 ++++++++++++++++++++++++++++++++
> include/linux/moduleloader.h | 4 +--
> kernel/Makefile | 2 +-
> kernel/bpf/core.c | 4 +--
> kernel/kprobes.c | 4 +--
> kernel/module.c | 37 ++++++--------------
> kernel/text.c | 25 +++++++++++++
> 45 files changed, 400 insertions(+), 275 deletions(-)
> create mode 100644 arch/arm/kernel/text.c
> create mode 100644 arch/arm64/kernel/text.c
> create mode 100644 arch/mips/kernel/text.c
> create mode 100644 arch/nds32/kernel/text.c
> create mode 100644 arch/nios2/kernel/text.c
> create mode 100644 arch/parisc/kernel/text.c
> create mode 100644 arch/riscv/kernel/text.c
> create mode 100644 arch/s390/kernel/text.c
> create mode 100644 arch/sparc/kernel/text.c
> create mode 100644 arch/unicore32/kernel/text.c
> create mode 100644 arch/x86/kernel/text.c
> create mode 100644 kernel/text.c
>
> diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
> index 89e5d864e923..69bfacfd60ef 100644
> --- a/arch/arm/kernel/Makefile
> +++ b/arch/arm/kernel/Makefile
> @@ -19,7 +19,8 @@ CFLAGS_REMOVE_return_address.o = -pg
> obj-y := elf.o entry-common.o irq.o opcodes.o \
> process.o ptrace.o reboot.o \
> setup.o signal.o sigreturn_codes.o \
> - stacktrace.o sys_arm.o time.o traps.o
> + stacktrace.o sys_arm.o time.o traps.o \
> + text.o
>
> ifneq ($(CONFIG_ARM_UNWIND),y)
> obj-$(CONFIG_FRAME_POINTER) += return_address.o
> diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
> index e15444b25ca0..13e3442a6b9f 100644
> --- a/arch/arm/kernel/module.c
> +++ b/arch/arm/kernel/module.c
> @@ -33,27 +33,6 @@
> #define MODULES_VADDR (((unsigned long)_exiprom + ~PMD_MASK) & PMD_MASK)
> #endif
>
> -#ifdef CONFIG_MMU
> -void *module_alloc(unsigned long size)
> -{
> - gfp_t gfp_mask = GFP_KERNEL;
> - void *p;
> -
> - /* Silence the initial allocation */
> - if (IS_ENABLED(CONFIG_ARM_MODULE_PLTS))
> - gfp_mask |= __GFP_NOWARN;
> -
> - p = __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END,
> - gfp_mask, PAGE_KERNEL_EXEC, 0, NUMA_NO_NODE,
> - __builtin_return_address(0));
> - if (!IS_ENABLED(CONFIG_ARM_MODULE_PLTS) || p)
> - return p;
> - return __vmalloc_node_range(size, 1, VMALLOC_START, VMALLOC_END,
> - GFP_KERNEL, PAGE_KERNEL_EXEC, 0, NUMA_NO_NODE,
> - __builtin_return_address(0));
> -}
> -#endif
> -
> bool module_init_section(const char *name)
> {
> return strstarts(name, ".init") ||
> diff --git a/arch/arm/kernel/text.c b/arch/arm/kernel/text.c
> new file mode 100644
> index 000000000000..600143fb909d
> --- /dev/null
> +++ b/arch/arm/kernel/text.c
> @@ -0,0 +1,33 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * linux/arch/arm/kernel/module.c
> + *
> + * Copyright (C) 2002 Russell King.
> + * Modified for nommu by Hyok S. Choi
> + *
> + * Module allocation method suggested by Andi Kleen.
> + */
> +#include <linux/mm.h>
> +#include <linux/moduleloader.h>
> +#include <linux/vmalloc.h>
> +
> +#ifdef CONFIG_MMU
> +void *text_alloc(unsigned long size)
> +{
> + gfp_t gfp_mask = GFP_KERNEL;
> + void *p;
> +
> + /* Silence the initial allocation */
> + if (IS_ENABLED(CONFIG_ARM_MODULE_PLTS))
> + gfp_mask |= __GFP_NOWARN;
> +
> + p = __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END,
> + gfp_mask, PAGE_KERNEL_EXEC, 0, NUMA_NO_NODE,
> + __builtin_return_address(0));
> + if (!IS_ENABLED(CONFIG_ARM_MODULE_PLTS) || p)
> + return p;
> + return __vmalloc_node_range(size, 1, VMALLOC_START, VMALLOC_END,
> + GFP_KERNEL, PAGE_KERNEL_EXEC, 0, NUMA_NO_NODE,
> + __builtin_return_address(0));
> +}
> +#endif
> diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile
> index a561cbb91d4d..7765a45d71b5 100644
> --- a/arch/arm64/kernel/Makefile
> +++ b/arch/arm64/kernel/Makefile
> @@ -19,7 +19,7 @@ obj-y := debug-monitors.o entry.o irq.o fpsimd.o \
> return_address.o cpuinfo.o cpu_errata.o \
> cpufeature.o alternative.o cacheinfo.o \
> smp.o smp_spin_table.o topology.o smccc-call.o \
> - syscall.o
> + syscall.o text.o
>
> targets += efi-entry.o
>
> diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c
> index 1cd1a4d0ed30..adde022f703c 100644
> --- a/arch/arm64/kernel/module.c
> +++ b/arch/arm64/kernel/module.c
> @@ -20,48 +20,6 @@
> #include <asm/insn.h>
> #include <asm/sections.h>
>
> -void *module_alloc(unsigned long size)
> -{
> - u64 module_alloc_end = module_alloc_base + MODULES_VSIZE;
> - gfp_t gfp_mask = GFP_KERNEL;
> - void *p;
> -
> - /* Silence the initial allocation */
> - if (IS_ENABLED(CONFIG_ARM64_MODULE_PLTS))
> - gfp_mask |= __GFP_NOWARN;
> -
> - if (IS_ENABLED(CONFIG_KASAN))
> - /* don't exceed the static module region - see below */
> - module_alloc_end = MODULES_END;
> -
> - p = __vmalloc_node_range(size, MODULE_ALIGN, module_alloc_base,
> - module_alloc_end, gfp_mask, PAGE_KERNEL, 0,
> - NUMA_NO_NODE, __builtin_return_address(0));
> -
> - if (!p && IS_ENABLED(CONFIG_ARM64_MODULE_PLTS) &&
> - !IS_ENABLED(CONFIG_KASAN))
> - /*
> - * KASAN can only deal with module allocations being served
> - * from the reserved module region, since the remainder of
> - * the vmalloc region is already backed by zero shadow pages,
> - * and punching holes into it is non-trivial. Since the module
> - * region is not randomized when KASAN is enabled, it is even
> - * less likely that the module region gets exhausted, so we
> - * can simply omit this fallback in that case.
> - */
> - p = __vmalloc_node_range(size, MODULE_ALIGN, module_alloc_base,
> - module_alloc_base + SZ_2G, GFP_KERNEL,
> - PAGE_KERNEL, 0, NUMA_NO_NODE,
> - __builtin_return_address(0));
> -
> - if (p && (kasan_module_alloc(p, size) < 0)) {
> - vfree(p);
> - return NULL;
> - }
> -
> - return p;
> -}
> -
> enum aarch64_reloc_op {
> RELOC_OP_NONE,
> RELOC_OP_ABS,
> diff --git a/arch/arm64/kernel/text.c b/arch/arm64/kernel/text.c
> new file mode 100644
> index 000000000000..64fc7e2d85df
> --- /dev/null
> +++ b/arch/arm64/kernel/text.c
> @@ -0,0 +1,54 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * AArch64 loadable module support.
> + *
> + * Copyright (C) 2012 ARM Limited
> + *
> + * Author: Will Deacon <will.deacon@arm.com>
> + */
> +#include <linux/kasan.h>
> +#include <linux/mm.h>
> +#include <linux/moduleloader.h>
> +#include <linux/vmalloc.h>
> +
> +void *text_alloc(unsigned long size)
> +{
> + u64 module_alloc_end = module_alloc_base + MODULES_VSIZE;
> + gfp_t gfp_mask = GFP_KERNEL;
> + void *p;
> +
> + /* Silence the initial allocation */
> + if (IS_ENABLED(CONFIG_ARM64_MODULE_PLTS))
> + gfp_mask |= __GFP_NOWARN;
> +
> + if (IS_ENABLED(CONFIG_KASAN))
> + /* don't exceed the static module region - see below */
> + module_alloc_end = MODULES_END;
> +
> + p = __vmalloc_node_range(size, MODULE_ALIGN, module_alloc_base,
> + module_alloc_end, gfp_mask, PAGE_KERNEL, 0,
> + NUMA_NO_NODE, __builtin_return_address(0));
> +
> + if (!p && IS_ENABLED(CONFIG_ARM64_MODULE_PLTS) &&
> + !IS_ENABLED(CONFIG_KASAN))
> + /*
> + * KASAN can only deal with module allocations being served
> + * from the reserved module region, since the remainder of
> + * the vmalloc region is already backed by zero shadow pages,
> + * and punching holes into it is non-trivial. Since the module
> + * region is not randomized when KASAN is enabled, it is even
> + * less likely that the module region gets exhausted, so we
> + * can simply omit this fallback in that case.
> + */
> + p = __vmalloc_node_range(size, MODULE_ALIGN, module_alloc_base,
> + module_alloc_base + SZ_2G, GFP_KERNEL,
> + PAGE_KERNEL, 0, NUMA_NO_NODE,
> + __builtin_return_address(0));
> +
> + if (p && (kasan_module_alloc(p, size) < 0)) {
> + vfree(p);
> + return NULL;
> + }
> +
> + return p;
> +}
> diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
> index 8c7a043295ed..37ebf9a7f259 100644
> --- a/arch/mips/kernel/Makefile
> +++ b/arch/mips/kernel/Makefile
> @@ -8,7 +8,7 @@ extra-y := head.o vmlinux.lds
> obj-y += cmpxchg.o cpu-probe.o branch.o elf.o entry.o genex.o
> idle.o irq.o \
> process.o prom.o ptrace.o reset.o setup.o signal.o \
> syscall.o time.o topology.o traps.o unaligned.o watch.o \
> - vdso.o cacheinfo.o
> + vdso.o cacheinfo.o text.o
>
> ifdef CONFIG_FUNCTION_TRACER
> CFLAGS_REMOVE_ftrace.o = -pg
> diff --git a/arch/mips/kernel/module.c b/arch/mips/kernel/module.c
> index 3c0c3d1260c1..f5ac4ebc4bad 100644
> --- a/arch/mips/kernel/module.c
> +++ b/arch/mips/kernel/module.c
> @@ -31,15 +31,6 @@ struct mips_hi16 {
> static LIST_HEAD(dbe_list);
> static DEFINE_SPINLOCK(dbe_lock);
>
> -#ifdef MODULE_START
> -void *module_alloc(unsigned long size)
> -{
> - return __vmalloc_node_range(size, 1, MODULE_START, MODULE_END,
> - GFP_KERNEL, PAGE_KERNEL, 0, NUMA_NO_NODE,
> - __builtin_return_address(0));
> -}
> -#endif
> -
> static int apply_r_mips_none(struct module *me, u32 *location,
> u32 base, Elf_Addr v, bool rela)
> {
> diff --git a/arch/mips/kernel/text.c b/arch/mips/kernel/text.c
> new file mode 100644
> index 000000000000..55ca87a421c3
> --- /dev/null
> +++ b/arch/mips/kernel/text.c
> @@ -0,0 +1,19 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + *
> + * Copyright (C) 2001 Rusty Russell.
> + * Copyright (C) 2003, 2004 Ralf Baechle (ralf@linux-mips.org)
> + * Copyright (C) 2005 Thiemo Seufer
> + */
> +#include <linux/mm.h>
> +#include <linux/moduleloader.h>
> +#include <linux/vmalloc.h>
> +
> +#ifdef MODULE_START
> +void *text_alloc(unsigned long size)
> +{
> + return __vmalloc_node_range(size, 1, MODULE_START, MODULE_END,
> + GFP_KERNEL, PAGE_KERNEL, 0, NUMA_NO_NODE,
> + __builtin_return_address(0));
> +}
> +#endif
> diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c
> index 0af88622c619..2b03f7128809 100644
> --- a/arch/mips/net/bpf_jit.c
> +++ b/arch/mips/net/bpf_jit.c
> @@ -1233,7 +1233,7 @@ void bpf_jit_compile(struct bpf_prog *fp)
> build_epilogue(&ctx);
>
> alloc_size = 4 * ctx.idx;
> - ctx.target = module_alloc(alloc_size);
> + ctx.target = text_alloc(alloc_size);
> if (ctx.target == NULL)
> goto out;
>
> @@ -1264,7 +1264,7 @@ void bpf_jit_compile(struct bpf_prog *fp)
> void bpf_jit_free(struct bpf_prog *fp)
> {
> if (fp->jited)
> - module_memfree(fp->bpf_func);
> + text_memfree(fp->bpf_func);
>
> bpf_prog_unlock_free(fp);
> }
> diff --git a/arch/nds32/kernel/Makefile b/arch/nds32/kernel/Makefile
> index 394df3f6442c..fc15778c59d1 100644
> --- a/arch/nds32/kernel/Makefile
> +++ b/arch/nds32/kernel/Makefile
> @@ -10,7 +10,7 @@ AFLAGS_head.o := -DTEXTADDR=$(TEXTADDR)
> obj-y := ex-entry.o ex-exit.o ex-scall.o irq.o \
> process.o ptrace.o setup.o signal.o \
> sys_nds32.o time.o traps.o cacheinfo.o \
> - dma.o syscall_table.o vdso.o
> + dma.o syscall_table.o vdso.o text.o
>
> obj-$(CONFIG_MODULES) += nds32_ksyms.o module.o
> obj-$(CONFIG_STACKTRACE) += stacktrace.o
> diff --git a/arch/nds32/kernel/module.c b/arch/nds32/kernel/module.c
> index 3897fd14a21d..3d23a12ed535 100644
> --- a/arch/nds32/kernel/module.c
> +++ b/arch/nds32/kernel/module.c
> @@ -7,13 +7,6 @@
> #include <linux/moduleloader.h>
> #include <linux/pgtable.h>
>
> -void *module_alloc(unsigned long size)
> -{
> - return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END,
> - GFP_KERNEL, PAGE_KERNEL, 0, NUMA_NO_NODE,
> - __builtin_return_address(0));
> -}
> -
> void module_free(struct module *module, void *region)
> {
> vfree(region);
> diff --git a/arch/nds32/kernel/text.c b/arch/nds32/kernel/text.c
> new file mode 100644
> index 000000000000..6e86eff9aaf0
> --- /dev/null
> +++ b/arch/nds32/kernel/text.c
> @@ -0,0 +1,12 @@
> +// SPDX-License-Identifier: GPL-2.0
> +// Copyright (C) 2005-2017 Andes Technology Corporation
> +#include <linux/mm.h>
> +#include <linux/moduleloader.h>
> +#include <linux/vmalloc.h>
> +
> +void *text_alloc(unsigned long size)
> +{
> + return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END,
> + GFP_KERNEL, PAGE_KERNEL, 0, NUMA_NO_NODE,
> + __builtin_return_address(0));
> +}
> diff --git a/arch/nios2/kernel/Makefile b/arch/nios2/kernel/Makefile
> index 0b645e1e3158..5476fc749f37 100644
> --- a/arch/nios2/kernel/Makefile
> +++ b/arch/nios2/kernel/Makefile
> @@ -18,6 +18,7 @@ obj-y += setup.o
> obj-y += signal.o
> obj-y += sys_nios2.o
> obj-y += syscall_table.o
> +obj-y += text.o
> obj-y += time.o
> obj-y += traps.o
>
> diff --git a/arch/nios2/kernel/module.c b/arch/nios2/kernel/module.c
> index 76e0a42d6e36..20a0faf64e38 100644
> --- a/arch/nios2/kernel/module.c
> +++ b/arch/nios2/kernel/module.c
> @@ -21,25 +21,6 @@
>
> #include <asm/cacheflush.h>
>
> -/*
> - * Modules should NOT be allocated with kmalloc for (obvious) reasons.
> - * But we do it for now to avoid relocation issues. CALL26/PCREL26
> cannot reach
> - * from 0x80000000 (vmalloc area) to 0xc00000000 (kernel) (kmalloc returns
> - * addresses in 0xc0000000)
> - */
> -void *module_alloc(unsigned long size)
> -{
> - if (size == 0)
> - return NULL;
> - return kmalloc(size, GFP_KERNEL);
> -}
> -
> -/* Free memory returned from module_alloc */
> -void module_memfree(void *module_region)
> -{
> - kfree(module_region);
> -}
> -
> int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
> unsigned int symindex, unsigned int relsec,
> struct module *mod)
> diff --git a/arch/nios2/kernel/text.c b/arch/nios2/kernel/text.c
> new file mode 100644
> index 000000000000..af424174442f
> --- /dev/null
> +++ b/arch/nios2/kernel/text.c
> @@ -0,0 +1,34 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Kernel module support for Nios II.
> + *
> + * Copyright (C) 2004 Microtronix Datacom Ltd.
> + * Written by Wentao Xu <xuwentao@microtronix.com>
> + * Copyright (C) 2001, 2003 Rusty Russell
> + *
> + * This file is subject to the terms and conditions of the GNU General
> + * Public License. See the file COPYING in the main directory of this
> + * archive for more details.
> + */
> +#include <linux/mm.h>
> +#include <linux/moduleloader.h>
> +#include <linux/vmalloc.h>
> +
> +/*
> + * Modules should NOT be allocated with kmalloc for (obvious) reasons.
> + * But we do it for now to avoid relocation issues. CALL26/PCREL26
> cannot reach
> + * from 0x80000000 (vmalloc area) to 0xc00000000 (kernel) (kmalloc returns
> + * addresses in 0xc0000000)
> + */
> +void *text_alloc(unsigned long size)
> +{
> + if (size == 0)
> + return NULL;
> + return kmalloc(size, GFP_KERNEL);
> +}
> +
> +/* Free memory returned from module_alloc */
> +void text_memfree(void *module_region)
> +{
> + kfree(module_region);
> +}
> diff --git a/arch/parisc/kernel/Makefile b/arch/parisc/kernel/Makefile
> index 068d90950d93..f71f7ffdae2e 100644
> --- a/arch/parisc/kernel/Makefile
> +++ b/arch/parisc/kernel/Makefile
> @@ -10,7 +10,7 @@ obj-y := cache.o pacache.o setup.o pdt.o
> traps.o time.o irq.o \
> ptrace.o hardware.o inventory.o drivers.o alternative.o \
> signal.o hpmc.o real2.o parisc_ksyms.o unaligned.o \
> process.o processor.o pdc_cons.o pdc_chassis.o unwind.o \
> - patch.o
> + patch.o text.o
>
> ifdef CONFIG_FUNCTION_TRACER
> # Do not profile debug and lowlevel utilities
> diff --git a/arch/parisc/kernel/module.c b/arch/parisc/kernel/module.c
> index 7df140545b22..c81e63e2549b 100644
> --- a/arch/parisc/kernel/module.c
> +++ b/arch/parisc/kernel/module.c
> @@ -192,17 +192,6 @@ static inline int reassemble_22(int as22)
> ((as22 & 0x0003ff) << 3));
> }
>
> -void *module_alloc(unsigned long size)
> -{
> - /* using RWX means less protection for modules, but it's
> - * easier than trying to map the text, data, init_text and
> - * init_data correctly */
> - return __vmalloc_node_range(size, 1, VMALLOC_START, VMALLOC_END,
> - GFP_KERNEL,
> - PAGE_KERNEL_RWX, 0, NUMA_NO_NODE,
> - __builtin_return_address(0));
> -}
> -
> #ifndef CONFIG_64BIT
> static inline unsigned long count_gots(const Elf_Rela *rela,
> unsigned long n)
> {
> diff --git a/arch/parisc/kernel/text.c b/arch/parisc/kernel/text.c
> new file mode 100644
> index 000000000000..9ff503084191
> --- /dev/null
> +++ b/arch/parisc/kernel/text.c
> @@ -0,0 +1,22 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Linux/PA-RISC Project
> + * Copyright (C) 2003 Randolph Chung <tausq at debian . org>
> + * Copyright (C) 2008 Helge Deller <deller@gmx.de>
> + */
> +#include <linux/mm.h>
> +#include <linux/moduleloader.h>
> +#include <linux/vmalloc.h>
> +
> +void *text_alloc(unsigned long size)
> +{
> + /*
> + * Using RWX means less protection for modules, but it's
> + * easier than trying to map the text, data, init_text and
> + * init_data correctly.
> + */
> + return __vmalloc_node_range(size, 1, VMALLOC_START, VMALLOC_END,
> + GFP_KERNEL,
> + PAGE_KERNEL_RWX, 0, NUMA_NO_NODE,
> + __builtin_return_address(0));
> +}
> diff --git a/arch/powerpc/net/bpf_jit_comp.c
> b/arch/powerpc/net/bpf_jit_comp.c
> index 0acc9d5fb19e..ba1cef7a812d 100644
> --- a/arch/powerpc/net/bpf_jit_comp.c
> +++ b/arch/powerpc/net/bpf_jit_comp.c
> @@ -634,7 +634,7 @@ void bpf_jit_compile(struct bpf_prog *fp)
>
> proglen = cgctx.idx * 4;
> alloclen = proglen + FUNCTION_DESCR_SIZE;
> - image = module_alloc(alloclen);
> + image = text_alloc(alloclen);
> if (!image)
> goto out;
>
> @@ -678,7 +678,7 @@ void bpf_jit_compile(struct bpf_prog *fp)
> void bpf_jit_free(struct bpf_prog *fp)
> {
> if (fp->jited)
> - module_memfree(fp->bpf_func);
> + text_memfree(fp->bpf_func);
>
> bpf_prog_unlock_free(fp);
> }
> diff --git a/arch/riscv/kernel/Makefile b/arch/riscv/kernel/Makefile
> index b355cf485671..d0b30f286ce6 100644
> --- a/arch/riscv/kernel/Makefile
> +++ b/arch/riscv/kernel/Makefile
> @@ -29,6 +29,7 @@ obj-y += riscv_ksyms.o
> obj-y += stacktrace.o
> obj-y += cacheinfo.o
> obj-y += patch.o
> +obj-y += text.o
> obj-$(CONFIG_MMU) += vdso.o vdso/
>
> obj-$(CONFIG_RISCV_M_MODE) += clint.o traps_misaligned.o
> diff --git a/arch/riscv/kernel/module.c b/arch/riscv/kernel/module.c
> index 7191342c54da..f6aa66431c9e 100644
> --- a/arch/riscv/kernel/module.c
> +++ b/arch/riscv/kernel/module.c
> @@ -390,15 +390,3 @@ int apply_relocate_add(Elf_Shdr *sechdrs, const
> char *strtab,
>
> return 0;
> }
> -
> -#if defined(CONFIG_MMU) && defined(CONFIG_64BIT)
> -#define VMALLOC_MODULE_START \
> - max(PFN_ALIGN((unsigned long)&_end - SZ_2G), VMALLOC_START)
> -void *module_alloc(unsigned long size)
> -{
> - return __vmalloc_node_range(size, 1, VMALLOC_MODULE_START,
> - VMALLOC_END, GFP_KERNEL,
> - PAGE_KERNEL_EXEC, 0, NUMA_NO_NODE,
> - __builtin_return_address(0));
> -}
> -#endif
> diff --git a/arch/riscv/kernel/text.c b/arch/riscv/kernel/text.c
> new file mode 100644
> index 000000000000..201608a25641
> --- /dev/null
> +++ b/arch/riscv/kernel/text.c
> @@ -0,0 +1,20 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + *
> + * Copyright (C) 2017 Zihao Yu
> + */
> +#include <linux/mm.h>
> +#include <linux/moduleloader.h>
> +#include <linux/vmalloc.h>
> +
> +#if defined(CONFIG_MMU) && defined(CONFIG_64BIT)
> +#define VMALLOC_MODULE_START \
> + max(PFN_ALIGN((unsigned long)&_end - SZ_2G), VMALLOC_START)
> +void *text_alloc(unsigned long size)
> +{
> + return __vmalloc_node_range(size, 1, VMALLOC_MODULE_START,
> + VMALLOC_END, GFP_KERNEL,
> + PAGE_KERNEL_EXEC, 0, NUMA_NO_NODE,
> + __builtin_return_address(0));
> +}
> +#endif
> diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile
> index a8f136943deb..9f00c320b938 100644
> --- a/arch/s390/kernel/Makefile
> +++ b/arch/s390/kernel/Makefile
> @@ -40,7 +40,7 @@ obj-y += sysinfo.o lgr.o os_info.o machine_kexec.o
> pgm_check.o
> obj-y += runtime_instr.o cache.o fpu.o dumpstack.o guarded_storage.o sthyi.o
> obj-y += entry.o reipl.o relocate_kernel.o kdebugfs.o alternative.o
> obj-y += nospec-branch.o ipl_vmparm.o machine_kexec_reloc.o unwind_bc.o
> -obj-y += smp.o
> +obj-y += smp.o text.o
>
> extra-y += head64.o vmlinux.lds
>
> diff --git a/arch/s390/kernel/ftrace.c b/arch/s390/kernel/ftrace.c
> index b388e87a08bf..a752b1442846 100644
> --- a/arch/s390/kernel/ftrace.c
> +++ b/arch/s390/kernel/ftrace.c
> @@ -134,7 +134,7 @@ static int __init ftrace_plt_init(void)
> {
> unsigned int *ip;
>
> - ftrace_plt = (unsigned long) module_alloc(PAGE_SIZE);
> + ftrace_plt = (unsigned long) text_alloc(PAGE_SIZE);
> if (!ftrace_plt)
> panic("cannot allocate ftrace plt\n");
> ip = (unsigned int *) ftrace_plt;
> diff --git a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c
> index 4055f1c49814..087cb5951de6 100644
> --- a/arch/s390/kernel/module.c
> +++ b/arch/s390/kernel/module.c
> @@ -32,22 +32,6 @@
>
> #define PLT_ENTRY_SIZE 20
>
> -void *module_alloc(unsigned long size)
> -{
> - void *p;
> -
> - if (PAGE_ALIGN(size) > MODULES_LEN)
> - return NULL;
> - p = __vmalloc_node_range(size, MODULE_ALIGN, MODULES_VADDR, MODULES_END,
> - GFP_KERNEL, PAGE_KERNEL_EXEC, 0, NUMA_NO_NODE,
> - __builtin_return_address(0));
> - if (p && (kasan_module_alloc(p, size) < 0)) {
> - vfree(p);
> - return NULL;
> - }
> - return p;
> -}
> -
> void module_arch_freeing_init(struct module *mod)
> {
> if (is_livepatch_module(mod) &&
> diff --git a/arch/s390/kernel/text.c b/arch/s390/kernel/text.c
> new file mode 100644
> index 000000000000..63aaa1ab727b
> --- /dev/null
> +++ b/arch/s390/kernel/text.c
> @@ -0,0 +1,23 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Kernel module help for s390.
> + */
> +#include <linux/mm.h>
> +#include <linux/moduleloader.h>
> +#include <linux/vmalloc.h>
> +
> +void *text_alloc(unsigned long size)
> +{
> + void *p;
> +
> + if (PAGE_ALIGN(size) > MODULES_LEN)
> + return NULL;
> + p = __vmalloc_node_range(size, MODULE_ALIGN, MODULES_VADDR, MODULES_END,
> + GFP_KERNEL, PAGE_KERNEL_EXEC, 0, NUMA_NO_NODE,
> + __builtin_return_address(0));
> + if (p && (kasan_module_alloc(p, size) < 0)) {
> + vfree(p);
> + return NULL;
> + }
> + return p;
> +}
> diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
> index 97c0e19263d1..e025f9e1db4a 100644
> --- a/arch/sparc/kernel/Makefile
> +++ b/arch/sparc/kernel/Makefile
> @@ -52,6 +52,7 @@ obj-y += prom_common.o
> obj-y += prom_$(BITS).o
> obj-y += of_device_common.o
> obj-y += of_device_$(BITS).o
> +obj-y += text.o
> obj-$(CONFIG_SPARC64) += prom_irqtrans.o
>
> obj-$(CONFIG_SPARC32) += leon_kernel.o
> diff --git a/arch/sparc/kernel/module.c b/arch/sparc/kernel/module.c
> index df39580f398d..f2babc69f189 100644
> --- a/arch/sparc/kernel/module.c
> +++ b/arch/sparc/kernel/module.c
> @@ -21,36 +21,6 @@
>
> #include "entry.h"
>
> -#ifdef CONFIG_SPARC64
> -
> -#include <linux/jump_label.h>
> -
> -static void *module_map(unsigned long size)
> -{
> - if (PAGE_ALIGN(size) > MODULES_LEN)
> - return NULL;
> - return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END,
> - GFP_KERNEL, PAGE_KERNEL, 0, NUMA_NO_NODE,
> - __builtin_return_address(0));
> -}
> -#else
> -static void *module_map(unsigned long size)
> -{
> - return vmalloc(size);
> -}
> -#endif /* CONFIG_SPARC64 */
> -
> -void *module_alloc(unsigned long size)
> -{
> - void *ret;
> -
> - ret = module_map(size);
> - if (ret)
> - memset(ret, 0, size);
> -
> - return ret;
> -}
> -
> /* Make generic code ignore STT_REGISTER dummy undefined symbols. */
> int module_frob_arch_sections(Elf_Ehdr *hdr,
> Elf_Shdr *sechdrs,
> diff --git a/arch/sparc/kernel/text.c b/arch/sparc/kernel/text.c
> new file mode 100644
> index 000000000000..d16663f2c6ba
> --- /dev/null
> +++ b/arch/sparc/kernel/text.c
> @@ -0,0 +1,39 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Kernel module help for sparc64.
> + *
> + * Copyright (C) 2001 Rusty Russell.
> + * Copyright (C) 2002 David S. Miller.
> + */
> +#include <linux/mm.h>
> +#include <linux/moduleloader.h>
> +#include <linux/vmalloc.h>
> +
> +#ifdef CONFIG_SPARC64
> +
> +#include <linux/jump_label.h>
> +
> +static void *module_map(unsigned long size)
> +{
> + if (PAGE_ALIGN(size) > MODULES_LEN)
> + return NULL;
> + return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END,
> + GFP_KERNEL, PAGE_KERNEL, 0, NUMA_NO_NODE,
> + __builtin_return_address(0));
> +}
> +#else
> +static void *module_map(unsigned long size)
> +{
> + return vmalloc(size);
> +}
> +#endif /* CONFIG_SPARC64 */
> +
> +void *text_alloc(unsigned long size)
> +{
> + void *ret;
> +
> + ret = module_map(size);
> + if (ret)
> + memset(ret, 0, size);
> +
> + return ret;
> +}
> diff --git a/arch/sparc/net/bpf_jit_comp_32.c
> b/arch/sparc/net/bpf_jit_comp_32.c
> index c8eabb973b86..d9dd513b27b2 100644
> --- a/arch/sparc/net/bpf_jit_comp_32.c
> +++ b/arch/sparc/net/bpf_jit_comp_32.c
> @@ -713,7 +713,7 @@ cond_branch: f_offset = addrs[i + filter[i].jf];
> if (unlikely(proglen + ilen > oldproglen)) {
> pr_err("bpb_jit_compile fatal error\n");
> kfree(addrs);
> - module_memfree(image);
> + text_memfree(image);
> return;
> }
> memcpy(image + proglen, temp, ilen);
> @@ -736,7 +736,7 @@ cond_branch: f_offset = addrs[i + filter[i].jf];
> break;
> }
> if (proglen == oldproglen) {
> - image = module_alloc(proglen);
> + image = text_alloc(proglen);
> if (!image)
> goto out;
> }
> @@ -758,7 +758,7 @@ cond_branch: f_offset = addrs[i + filter[i].jf];
> void bpf_jit_free(struct bpf_prog *fp)
> {
> if (fp->jited)
> - module_memfree(fp->bpf_func);
> + text_memfree(fp->bpf_func);
>
> bpf_prog_unlock_free(fp);
> }
> diff --git a/arch/unicore32/kernel/Makefile b/arch/unicore32/kernel/Makefile
> index 2f79aa56735b..96eb8cfc8b1e 100644
> --- a/arch/unicore32/kernel/Makefile
> +++ b/arch/unicore32/kernel/Makefile
> @@ -6,6 +6,7 @@
> # Object file lists.
> obj-y := dma.o elf.o entry.o process.o ptrace.o
> obj-y += setup.o signal.o sys.o stacktrace.o traps.o
> +obj-y += text.o
>
> obj-$(CONFIG_MODULES) += ksyms.o module.o
> obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
> diff --git a/arch/unicore32/kernel/module.c b/arch/unicore32/kernel/module.c
> index 67c89ef2d6ee..e1e703c02379 100644
> --- a/arch/unicore32/kernel/module.c
> +++ b/arch/unicore32/kernel/module.c
> @@ -18,13 +18,6 @@
>
> #include <asm/sections.h>
>
> -void *module_alloc(unsigned long size)
> -{
> - return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END,
> - GFP_KERNEL, PAGE_KERNEL_EXEC, 0, NUMA_NO_NODE,
> - __builtin_return_address(0));
> -}
> -
> int
> apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned
> int symindex,
> unsigned int relindex, struct module *module)
> diff --git a/arch/unicore32/kernel/text.c b/arch/unicore32/kernel/text.c
> new file mode 100644
> index 000000000000..b94aac824bb8
> --- /dev/null
> +++ b/arch/unicore32/kernel/text.c
> @@ -0,0 +1,18 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * linux/arch/unicore32/kernel/module.c
> + *
> + * Code specific to PKUnity SoC and UniCore ISA
> + *
> + * Copyright (C) 2001-2010 GUAN Xue-tao
> + */
> +#include <linux/mm.h>
> +#include <linux/moduleloader.h>
> +#include <linux/vmalloc.h>
> +
> +void *text_alloc(unsigned long size)
> +{
> + return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END,
> + GFP_KERNEL, PAGE_KERNEL_EXEC, 0, NUMA_NO_NODE,
> + __builtin_return_address(0));
> +}
> diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
> index e77261db2391..2878e4b753a0 100644
> --- a/arch/x86/kernel/Makefile
> +++ b/arch/x86/kernel/Makefile
> @@ -68,6 +68,7 @@ obj-y += tsc.o tsc_msr.o io_delay.o rtc.o
> obj-y += pci-iommu_table.o
> obj-y += resource.o
> obj-y += irqflags.o
> +obj-y += text.o
>
> obj-y += process.o
> obj-y += fpu/
> diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
> index 51504566b3a6..f76703ee96f2 100644
> --- a/arch/x86/kernel/ftrace.c
> +++ b/arch/x86/kernel/ftrace.c
> @@ -265,11 +265,11 @@ int __init ftrace_dyn_arch_init(void)
> /* Module allocation simplifies allocating memory for code */
> static inline void *alloc_tramp(unsigned long size)
> {
> - return module_alloc(size);
> + return text_alloc(size);
> }
> static inline void tramp_free(void *tramp)
> {
> - module_memfree(tramp);
> + text_memfree(tramp);
> }
> #else
> /* Trampolines can only be created if modules are supported */
> diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
> index ada39ddbc922..e9ac7d3c658e 100644
> --- a/arch/x86/kernel/kprobes/core.c
> +++ b/arch/x86/kernel/kprobes/core.c
> @@ -423,7 +423,7 @@ void *alloc_insn_page(void)
> {
> void *page;
>
> - page = module_alloc(PAGE_SIZE);
> + page = text_alloc(PAGE_SIZE);
> if (!page)
> return NULL;
>
> @@ -446,7 +446,7 @@ void *alloc_insn_page(void)
> /* Recover page to RW mode before releasing it */
> void free_insn_page(void *page)
> {
> - module_memfree(page);
> + text_memfree(page);
> }
>
> static int arch_copy_kprobe(struct kprobe *p)
> diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c
> index 34b153cbd4ac..261df078f127 100644
> --- a/arch/x86/kernel/module.c
> +++ b/arch/x86/kernel/module.c
> @@ -36,55 +36,6 @@ do { \
> } while (0)
> #endif
>
> -#ifdef CONFIG_RANDOMIZE_BASE
> -static unsigned long module_load_offset;
> -
> -/* Mutex protects the module_load_offset. */
> -static DEFINE_MUTEX(module_kaslr_mutex);
> -
> -static unsigned long int get_module_load_offset(void)
> -{
> - if (kaslr_enabled()) {
> - mutex_lock(&module_kaslr_mutex);
> - /*
> - * Calculate the module_load_offset the first time this
> - * code is called. Once calculated it stays the same until
> - * reboot.
> - */
> - if (module_load_offset == 0)
> - module_load_offset =
> - (get_random_int() % 1024 + 1) * PAGE_SIZE;
> - mutex_unlock(&module_kaslr_mutex);
> - }
> - return module_load_offset;
> -}
> -#else
> -static unsigned long int get_module_load_offset(void)
> -{
> - return 0;
> -}
> -#endif
> -
> -void *module_alloc(unsigned long size)
> -{
> - void *p;
> -
> - if (PAGE_ALIGN(size) > MODULES_LEN)
> - return NULL;
> -
> - p = __vmalloc_node_range(size, MODULE_ALIGN,
> - MODULES_VADDR + get_module_load_offset(),
> - MODULES_END, GFP_KERNEL,
> - PAGE_KERNEL, 0, NUMA_NO_NODE,
> - __builtin_return_address(0));
> - if (p && (kasan_module_alloc(p, size) < 0)) {
> - vfree(p);
> - return NULL;
> - }
> -
> - return p;
> -}
> -
> #ifdef CONFIG_X86_32
> int apply_relocate(Elf32_Shdr *sechdrs,
> const char *strtab,
> diff --git a/arch/x86/kernel/text.c b/arch/x86/kernel/text.c
> new file mode 100644
> index 000000000000..724ab2d93ac5
> --- /dev/null
> +++ b/arch/x86/kernel/text.c
> @@ -0,0 +1,60 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Kernel module help for x86.
> + * Copyright (C) 2001 Rusty Russell.
> + */
> +#include <linux/kasan.h>
> +#include <linux/mm.h>
> +#include <linux/moduleloader.h>
> +#include <linux/random.h>
> +#include <linux/vmalloc.h>
> +#include <asm/setup.h>
> +
> +#ifdef CONFIG_RANDOMIZE_BASE
> +static unsigned long module_load_offset;
> +
> +/* Mutex protects the module_load_offset. */
> +static DEFINE_MUTEX(module_kaslr_mutex);
> +
> +static unsigned long get_module_load_offset(void)
> +{
> + if (kaslr_enabled()) {
> + mutex_lock(&module_kaslr_mutex);
> + /*
> + * Calculate the module_load_offset the first time this
> + * code is called. Once calculated it stays the same until
> + * reboot.
> + */
> + if (module_load_offset == 0)
> + module_load_offset =
> + (get_random_int() % 1024 + 1) * PAGE_SIZE;
> + mutex_unlock(&module_kaslr_mutex);
> + }
> + return module_load_offset;
> +}
> +#else
> +static unsigned long get_module_load_offset(void)
> +{
> + return 0;
> +}
> +#endif
> +
> +void *text_alloc(unsigned long size)
> +{
> + void *p;
> +
> + if (PAGE_ALIGN(size) > MODULES_LEN)
> + return NULL;
> +
> + p = __vmalloc_node_range(size, MODULE_ALIGN,
> + MODULES_VADDR + get_module_load_offset(),
> + MODULES_END, GFP_KERNEL,
> + PAGE_KERNEL, 0, NUMA_NO_NODE,
> + __builtin_return_address(0));
> + if (p && (kasan_module_alloc(p, size) < 0)) {
> + vfree(p);
> + return NULL;
> + }
> +
> + return p;
> +}
> diff --git a/include/linux/moduleloader.h b/include/linux/moduleloader.h
> index 4fa67a8b2265..4e8b9ba431ee 100644
> --- a/include/linux/moduleloader.h
> +++ b/include/linux/moduleloader.h
> @@ -24,10 +24,10 @@ unsigned int arch_mod_section_prepend(struct
> module *mod, unsigned int section);
>
> /* Allocator used for allocating struct module, core sections and init
> sections. Returns NULL on failure. */
> -void *module_alloc(unsigned long size);
> +void *text_alloc(unsigned long size);
>
> /* Free memory returned from module_alloc. */
> -void module_memfree(void *module_region);
> +void text_memfree(void *module_region);
>
> /* Determines if the section name is an init section (that is only
> used during
> * module loading).
> diff --git a/kernel/Makefile b/kernel/Makefile
> index f3218bc5ec69..9e88e81f68ef 100644
> --- a/kernel/Makefile
> +++ b/kernel/Makefile
> @@ -10,7 +10,7 @@ obj-y = fork.o exec_domain.o panic.o \
> extable.o params.o \
> kthread.o sys_ni.o nsproxy.o \
> notifier.o ksysfs.o cred.o reboot.o \
> - async.o range.o smpboot.o ucount.o
> + async.o range.o smpboot.o ucount.o text.o
>
> obj-$(CONFIG_MODULES) += kmod.o
> obj-$(CONFIG_MULTIUSER) += groups.o
> diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
> index 9df4cc9a2907..febd55019a8a 100644
> --- a/kernel/bpf/core.c
> +++ b/kernel/bpf/core.c
> @@ -840,12 +840,12 @@ static void bpf_jit_uncharge_modmem(u32 pages)
>
> void *__weak bpf_jit_alloc_exec(unsigned long size)
> {
> - return module_alloc(size);
> + return text_alloc(size);
> }
>
> void __weak bpf_jit_free_exec(void *addr)
> {
> - module_memfree(addr);
> + text_memfree(addr);
> }
>
> struct bpf_binary_header *
> diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> index 4a904cc56d68..d1c354ec89de 100644
> --- a/kernel/kprobes.c
> +++ b/kernel/kprobes.c
> @@ -111,12 +111,12 @@ enum kprobe_slot_state {
>
> void __weak *alloc_insn_page(void)
> {
> - return module_alloc(PAGE_SIZE);
> + return text_alloc(PAGE_SIZE);
> }
>
> void __weak free_insn_page(void *page)
> {
> - module_memfree(page);
> + text_memfree(page);
> }
>
> struct kprobe_insn_cache kprobe_insn_slots = {
> diff --git a/kernel/module.c b/kernel/module.c
> index bee1c25ca5c5..bdb3773f3668 100644
> --- a/kernel/module.c
> +++ b/kernel/module.c
> @@ -2141,16 +2141,6 @@ static void free_module_elf(struct module *mod)
> }
> #endif /* CONFIG_LIVEPATCH */
>
> -void __weak module_memfree(void *module_region)
> -{
> - /*
> - * This memory may be RO, and freeing RO memory in an interrupt is not
> - * supported by vmalloc.
> - */
> - WARN_ON(in_interrupt());
> - vfree(module_region);
> -}
> -
> void __weak module_arch_cleanup(struct module *mod)
> {
> }
> @@ -2200,7 +2190,7 @@ static void free_module(struct module *mod)
>
> /* This may be empty, but that's OK */
> module_arch_freeing_init(mod);
> - module_memfree(mod->init_layout.base);
> + text_memfree(mod->init_layout.base);
> kfree(mod->args);
> percpu_modfree(mod);
>
> @@ -2208,7 +2198,7 @@ static void free_module(struct module *mod)
> lockdep_free_key_range(mod->core_layout.base, mod->core_layout.size);
>
> /* Finally, free the core (containing the module structure) */
> - module_memfree(mod->core_layout.base);
> + text_memfree(mod->core_layout.base);
> }
>
> void *__symbol_get(const char *symbol)
> @@ -2781,13 +2771,6 @@ static void dynamic_debug_remove(struct
> module *mod, struct _ddebug *debug)
> ddebug_remove_module(mod->name);
> }
>
> -void * __weak module_alloc(unsigned long size)
> -{
> - return __vmalloc_node_range(size, 1, VMALLOC_START, VMALLOC_END,
> - GFP_KERNEL, PAGE_KERNEL_EXEC, VM_FLUSH_RESET_PERMS,
> - NUMA_NO_NODE, __builtin_return_address(0));
> -}
> -
> bool __weak module_init_section(const char *name)
> {
> return strstarts(name, ".init");
> @@ -3246,7 +3229,7 @@ static int move_module(struct module *mod,
> struct load_info *info)
> void *ptr;
>
> /* Do the allocs. */
> - ptr = module_alloc(mod->core_layout.size);
> + ptr = text_alloc(mod->core_layout.size);
> /*
> * The pointer to this block is stored in the module structure
> * which is inside the block. Just mark it as not being a
> @@ -3260,7 +3243,7 @@ static int move_module(struct module *mod,
> struct load_info *info)
> mod->core_layout.base = ptr;
>
> if (mod->init_layout.size) {
> - ptr = module_alloc(mod->init_layout.size);
> + ptr = text_alloc(mod->init_layout.size);
> /*
> * The pointer to this block is stored in the module structure
> * which is inside the block. This block doesn't need to be
> @@ -3269,7 +3252,7 @@ static int move_module(struct module *mod,
> struct load_info *info)
> */
> kmemleak_ignore(ptr);
> if (!ptr) {
> - module_memfree(mod->core_layout.base);
> + text_memfree(mod->core_layout.base);
> return -ENOMEM;
> }
> memset(ptr, 0, mod->init_layout.size);
> @@ -3452,8 +3435,8 @@ static void module_deallocate(struct module
> *mod, struct load_info *info)
> {
> percpu_modfree(mod);
> module_arch_freeing_init(mod);
> - module_memfree(mod->init_layout.base);
> - module_memfree(mod->core_layout.base);
> + text_memfree(mod->init_layout.base);
> + text_memfree(mod->core_layout.base);
> }
>
> int __weak module_finalize(const Elf_Ehdr *hdr,
> @@ -3527,7 +3510,7 @@ static void do_free_init(struct work_struct *w)
>
> llist_for_each_safe(pos, n, list) {
> initfree = container_of(pos, struct mod_initfree, node);
> - module_memfree(initfree->module_init);
> + text_memfree(initfree->module_init);
> kfree(initfree);
> }
> }
> @@ -3626,10 +3609,10 @@ static noinline int do_init_module(struct
> module *mod)
> * We want to free module_init, but be aware that kallsyms may be
> * walking this with preempt disabled. In all the failure paths, we
> * call synchronize_rcu(), but we don't want to slow down the success
> - * path. module_memfree() cannot be called in an interrupt, so do the
> + * path. text_memfree() cannot be called in an interrupt, so do the
> * work and call synchronize_rcu() in a work queue.
> *
> - * Note that module_alloc() on most architectures creates W+X page
> + * Note that text_alloc() on most architectures creates W+X page
> * mappings which won't be cleaned up until do_free_init() runs. Any
> * code such as mark_rodata_ro() which depends on those mappings to
> * be cleaned up needs to sync with the queued work - ie
> diff --git a/kernel/text.c b/kernel/text.c
> new file mode 100644
> index 000000000000..9a12c508ded5
> --- /dev/null
> +++ b/kernel/text.c
> @@ -0,0 +1,25 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (C) 2002 Richard Henderson
> + * Copyright (C) 2001 Rusty Russell, 2002, 2010 Rusty Russell IBM.
> + */
> +#include <linux/mm.h>
> +#include <linux/moduleloader.h>
> +#include <linux/vmalloc.h>
> +
> +void __weak text_memfree(void *module_region)
> +{
> + /*
> + * This memory may be RO, and freeing RO memory in an interrupt is not
> + * supported by vmalloc.
> + */
> + WARN_ON(in_interrupt());
> + vfree(module_region);
> +}
> +
> +void * __weak text_alloc(unsigned long size)
> +{
> + return __vmalloc_node_range(size, 1, VMALLOC_START, VMALLOC_END,
> + GFP_KERNEL, PAGE_KERNEL_EXEC, VM_FLUSH_RESET_PERMS,
> + NUMA_NO_NODE, __builtin_return_address(0));
> +}
> --
> 2.25.1
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.