Commit Graph

2 Commits

Author SHA1 Message Date
Herton R. Krzesinski a1b9805d99 kbuild: use $(src) instead of $(srctree)/$(src) for source directory
JIRA: https://issues.redhat.com/browse/RHEL-107194

commit b1992c3772e69a6fd0e3fc81cd4d2820c8b6eca0
Author: Masahiro Yamada <masahiroy@kernel.org>
Date:   Sat Apr 27 23:55:02 2024 +0900

    kbuild: use $(src) instead of $(srctree)/$(src) for source directory

    Kbuild conventionally uses $(obj)/ for generated files, and $(src)/ for
    checked-in source files. It is merely a convention without any functional
    difference. In fact, $(obj) and $(src) are exactly the same, as defined
    in scripts/Makefile.build:

        src := $(obj)

    When the kernel is built in a separate output directory, $(src) does
    not accurately reflect the source directory location. While Kbuild
    resolves this discrepancy by specifying VPATH=$(srctree) to search for
    source files, it does not cover all cases. For example, when adding a
    header search path for local headers, -I$(srctree)/$(src) is typically
    passed to the compiler.

    This introduces inconsistency between upstream and downstream Makefiles
    because $(src) is used instead of $(srctree)/$(src) for the latter.

    To address this inconsistency, this commit changes the semantics of
    $(src) so that it always points to the directory in the source tree.

    Going forward, the variables used in Makefiles will have the following
    meanings:

      $(obj)     - directory in the object tree
      $(src)     - directory in the source tree  (changed by this commit)
      $(objtree) - the top of the kernel object tree
      $(srctree) - the top of the kernel source tree

    Consequently, $(srctree)/$(src) in upstream Makefiles need to be replaced
    with $(src).

    Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
    Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>

Conflicts:

There is a extensive list of fixes/conflicts due the amount of files originally
changed by this commit, plus the difference of rhel-9 code against upstream. All
conflicts/differences are listed below:

- Context difference at Documentation/Makefile since RHEL 9 does not have the
  change "docs: allow to pass extra DOCS_CSS themes via make" and later changes.
- Conflict at Documentation/devicetree/bindings/Makefile, patch find_cmd instead
  of find_all_cmd since RHEL-9 doesn't have "dt-bindings: Consider
  DT_SCHEMA_FILES when finding all json-schema", "dt-bindings: kbuild: Split
  targets out to separate rules" and later changes.
- Conflict at Documentation/kbuild/makefiles.rst due different identation since
  RHEL-9 doesn't have the change "docs/kbuild/makefiles: clean up indentation
  and whitespace"
- Patched additional $(srctree)/$(src) references at:
   * arch/arm/mach-davinci/Makefile
   * arch/arm/mach-omap2/Makefile
   * arch/arm/mach-spear/Makefile
   * arch/arm/plat-pxa/Makefile
   * arch/arm/plat-versatile/Makefile
   * arch/ia64/kernel/Makefile
   * arch/nds32/boot/Makefile
   * arch/nds32/kernel/vdso/Makefile
   * drivers/net/ethernet/hisilicon/hns3/hns3pf/Makefile
   * drivers/net/ethernet/hisilicon/hns3/hns3vf/Makefile
   * drivers/staging/rtl8188eu/Makefile
   * drivers/staging/unisys/visorhba/Makefile
   * drivers/staging/unisys/visornic/Makefile
   * scripts/gcc-plugins/Makefile
  Since RHEL-9 does not have later upstream changes that dropped/made those
  references uneeded.
- Conflict at arch/arm/mach-s3c/Makefile since RHEL-9 doesn't have
  "ARM: s3c: remove s3c24xx specific hacks" and related changes. Also,
  extra locations needed patching because of not having the changes
  "ARM: s3c: remove all s3c24xx support" and "ARM: s3c: fix include path".
  Due lacking the last change also arch/arm/mach-s3c/Makefile.s3c64xx needs
  additional two places patched as well.
- Conflict at arch/arm/plat-orion/Makefile since RHEL-9 doesn't have
  the commit "ARM: orion: fix include path" and its previous related
  changes.
- Dropped changes for arch/loongarch since it doesn't exist on rhel-9
- Dropped changes to arch/parisc/kernel/{vdso32,vdso64}/Makefile since RHEL 9
  does not have the change "parisc: Add vDSO support" and later updates to it.
- Dropped change to arch/riscv/kernel/compat_vdso/Makefile since RHEL 9 does
  not have the change "riscv: compat: vdso: Add COMPAT_VDSO base code implementation"
- Dropped change to arch/riscv/kvm/Makefile since there is no KVM support/commits
  in RHEL 9 for riscv.
- Apply change for arch/riscv/kernel/vdso/Makefile in a different place since
  RHEL-9 does not have the change "riscv: explicitly use symbol offsets for VDSO"
  which changed the location of the $(srctree)/$(src) reference
- Dropped change to certs/Makefile related to check-blacklist-hashes.awk since
  that script was only added with commit "certs: Check that builtin blacklist
  hashes are valid" which is not backported/available in RHEL 9 code right now.
- Dropped change to drivers/md/dm-vdo/Makefile since dm-vdo was never backported
  to RHEL-9 main.
- Dropped change to drivers/net/ethernet/fungible/funeth/Makefile since fungible
  ethernet driver/devices code is not available/backported to RHEL-9.
- Fixed conflict at drivers/net/ethernet/hisilicon/hns3/Makefile since RHEL-9
  does not have the change "net: hns3: refactor hns3 makefile to support
  hns3_common module"
- Fixed conflict at drivers/net/wireless/intel/iwlwifi/mvm/Makefile due already
  backported commit "wifi: iwlwifi: mvm: implement link grading"
- Dropped change to init/Makefile since we are not backporting
  "kbuild: build init/built-in.a just once" that introduced the section patched.
- Dropped change to rust/Makefile since there is no rust support backported
  to RHEL-9.
- Fixed conflict at scripts/dtc/Makefile since RHEL-9 does not have the change
  "dt-bindings: kbuild: Use DTB files for validation"
- Dropped change to security/tomoyo/Makefile since it's not needed, it's just
  reverting the change "tomoyo: fix broken dependency on *.conf.default" which
  was never applied to RHEL-9. However, we also bring a different change/patch
  location since RHEL-9 does not have the change "tomoyo: Omit use of bin2c".
- Dropped change to usr/include/Makefile since "kbuild: move headers_check.pl to
  usr/include/" is not being backported to RHEL-9.
- Misc/minor context differences at other places.

Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
2025-08-19 20:06:24 -03:00
Íñigo Huguet a0caa8501d iwlwifi: mei: add the driver to allow cooperation with CSME
Bugzilla: https://bugzilla.redhat.com/2059999

commit 2da4366f9e2c44afedec4acad65a99a3c7da1a35
Author: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Date:   Fri Nov 12 08:28:10 2021 +0200

    iwlwifi: mei: add the driver to allow cooperation with CSME
    
    CSME in two words
    -----------------
    CSME stands for Converged Security and Management Engine. It is
    a CPU on the chipset and runs a dedicated firmware.
    AMT (Active Management Technology) is one of the applications
    that run on that CPU. AMT allows to control the platform remotely.
    Here is a partial list of the use cases:
    * View the screen of the plaform, with keyboard and mouse (KVM)
    * Attach a remote IDE device
    * Have a serial console to the device
    * Query the state of the platform
    * Reset / shut down / boot the platform
    
    Networking in CSME
    ------------------
    For those uses cases, CSME's firmware has an embedded network
    stack and is able to use the network devices of the system: LAN
    and WLAN. This is thanks to the CSME's firmware WLAN driver.
    
    One can add a profile (SSID / key / certificate) to the CSME's OS
    and CSME will connect to that profile. Then, one can use the WLAN
    link to access the applications that run on CSME (AMT is one of
    them). Note that CSME is active during power state and power state
    transitions. For example, it is possible to have a KVM session
    open to the system while the system is rebooting and actually
    configure the BIOS remotely over WLAN thanks to AMT.
    
    How all this is related to Linux
    --------------------------------
    In Linux, there is a driver that allows the OS to talk to the
    CSME firmware, this driver is drivers/misc/mei. This driver
    advertises a bus that allows other kernel drivers or even user
    space) to talk to components inside the CSME firmware.
    In practice, the system advertises a PCI device that allows
    to send / receive data to / from the CSME firmware. The mei
    bus drivers in drivers/misc/mei is an abstration on top of
    this PCI device.
    The driver being added here is called iwlmei and talks to the
    WLAN driver inside the CSME firmware through the mei bus driver.
    Note that the mei bus driver only gives bus services, it doesn't
    define the content of the communication.
    
    Why do we need this driver?
    --------------------------
    CSME uses the same WLAN device that the OS is expecting to see
    hence we need an arbitration mechanism. This is what iwlmei is
    in charge of. iwlmei maintains the communication with the CSME
    firmware's WLAN driver. The language / protocol that is used
    between the CSME's firmware WLAN driver and iwlmei is OS agnostic
    and is called SAP which stands for Software Abritration Protocol.
    With SAP, iwlmei will be able to tell the CSME firmware's WLAN
    driver:
    1) Please give me the device.
    2) Please note that the SW/HW rfkill state change.
    3) Please note that I am now associated to X.
    4) Please note that I received this packet.
    etc...
    
    There are messages that go the opposite direction as well:
    1) Please note that AMT is en/disable.
    2) Please note that I believe the OS is broken and hence I'll take
       the device *now*, whether you like it or not, to make sure that
       connectivity is preserved.
    3) Please note that I am willing to give the device if the OS
       needs it.
    4) Please give me any packet that is sent on UDP / TCP on IP address
       XX.XX.XX.XX and an port ZZ.
    5) Please send this packet.
    etc...
    
    Please check drivers/net/wireless/intel/iwlwifi/mei/sap.h for the
    full protocol specification.
    
    Arbitration is not the only purpose of iwlmei and SAP. SAP also
    allows to maintain the AMT's functionality even when the OS owns
    the device. To connect to AMT, one needs to initiate an HTTP
    connection to port 16992. iwlmei will listen to the Rx path and
    forward (through SAP) to the CSME firmware the data it got. Then,
    the embedded HTTP server in the chipset will reply to the request
    and send a SAP notification to ask iwlmei to send the reply.
    This way, AMT running on the CSME can still work.
    
    In practice this means that all the use cases quoted above (KVM,
    remote IDE device, etc...) will work even when the OS uses the
    WLAN device.
    
    How to disable all this?
    ---------------------------
    iwlmei won't be able to do anything if the CSME's networking stack
    is not enabled. By default, CSME's networking stack is disabled (this
    is a BIOS setting).
    In case the CSME's networking stack is disabled, iwlwifi will just
    get access to the device because there is no contention with any other
    actor and, hence, no arbitration is needed.
    
    In this patch, I only add the iwlmei driver. Integration with
    iwlwifi will be implemented in the next one.
    
    Co-Developed-by: Ayala Beker <ayala.beker@intel.com>
    Signed-off-by: Ayala Beker <ayala.beker@intel.com>
    Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
    
    v2: fix a few warnings raised by the different bots
    v3: rewrite the commit message
    v4: put the debugfs content in a different patch
    v5: fix a NULL pointer dereference upon DHCP TX if SAP is connected
        since we now have the required cfg80211 bits in wl-drv-next, add
        the RFKILL handling patch to this series.
    v6: change the SAP API to inherit the values from iwl-mei.h removing
        the need to ensure the values are equal with a BUILD_BUG_ON.
        This was suggested by Arend
    v7: * fix a locking issue in case of CSME firmware reset:
          When the CSME firmware resets, we need to unregister the
          netdev, first take the mutex, and only then, rely on it
          being taken.
        * Add a comment to explain why it is ok to have static variables
          (iwlmei can't have more than a single instance).
        * Add a define for 26 + 8 + 8
        * Add a define SEND_SAP_MAX_WAIT_ITERATION
        * make struct const
        * Reword a bit the Kconfig help message
        * Ayala added her Signed-off
        * fixed an RCU annotation
    v8: do not require ownership upfront, use NIC_OWNER instead. This fixes
        a deadlock when CSME does not have the right WiFi FW.
        Add more documentation about the owernship transition
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Link: https://lore.kernel.org/r/20211112062814.7502-2-emmanuel.grumbach@intel.com

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:49:37 +02:00