1
0
Fork 0

모듈 포함하도록 수정

This commit is contained in:
Sangbum Kim 2016-12-07 02:07:23 +09:00
parent 5510415b51
commit e952eeece7
9 changed files with 6079 additions and 796 deletions

148
PKGBUILD
View File

@ -7,7 +7,7 @@ pkgname=$pkgbase
# comment the following line to build a single package containing the kernel and the headers # comment the following line to build a single package containing the kernel and the headers
(( 1 )) && pkgname=("$pkgbase" "$pkgbase-headers" "$pkgbase-docs") (( 1 )) && pkgname=("$pkgbase" "$pkgbase-headers" "$pkgbase-docs")
pkgdesc="The Linux Kernel and modules from Linus' git tree" pkgdesc="The Linux Kernel and modules from Linus' git tree"
depends=('coreutils' 'linux-firmware' 'mkinitcpio') depends=('coreutils' 'linux-firmware' 'module-init-tools' 'mkinitcpio')
pkgver=4.9.rc7 pkgver=4.9.rc7
pkgrel=1 pkgrel=1
@ -61,7 +61,15 @@ _gitrev="v4.8.12"
# #
# Uncomment desired options # Uncomment desired options
############################# #############################
#_make_modules=0 _make_modules=1
#######
# Skip the merge of Linus's kernel tree
#
# _skip_merge=1
MAKEFLAGS="-j $(expr $(cat /proc/cpuinfo |grep processor |wc -l) \* 2)" MAKEFLAGS="-j $(expr $(cat /proc/cpuinfo |grep processor |wc -l) \* 2)"
####### #######
@ -87,12 +95,29 @@ _config_cmd="${_config_cmd:-menuconfig}"
# _configure_only=1 # _configure_only=1
#######
# The directory where the kernel should be built
#
# Can be useful, for example, if you want to compile on a
# tmpfs mount, which can speed up the compilation process
#
#_build_dir="${_build_dir:-$srcdir}"
####### #######
# Append the date to the localversion # Append the date to the localversion
# #
# e.g. -ARCH -> -ARCH-20090422 # e.g. -ARCH -> -ARCH-20090422
# #
# _date_localversion=1 _date_localversion=0
#######
# Set the pkgver to the kernel version
# rather than the build date
#
# _kernel_pkgver=1
####### #######
@ -105,7 +130,7 @@ _save_config=1
####### #######
# Do not compress kernel modules # Do not compress kernel modules
# #
# _no_modules_compression=1 _no_modules_compression=0
####### #######
@ -117,6 +142,8 @@ _save_config=1
# internal variables # internal variables
(( 1 )) && _kernel_src="$pkgname" (( 1 )) && _kernel_src="$pkgname"
#(( 1 )) && _kernel_src="$BUILDDIR/$(find . -maxdepth 1 -type d -name "linux-*" -printf "%f\n" | head -1)" #(( 1 )) && _kernel_src="$BUILDDIR/$(find . -maxdepth 1 -type d -name "linux-*" -printf "%f\n" | head -1)"
#(( 1 )) && _kernel_src="$_build_dir/$pkgname_$"
####### #######
# define required functions # define required functions
@ -133,9 +160,9 @@ package() {
} }
# split package functions # split package functions
eval "package_$pkgbase() { _generic_package_linux; }" eval "package_$pkgbase() { _generic_package_kernel; }"
eval "package_$pkgbase-headers() { _generic_package_linux-headers; }" eval "package_$pkgbase-headers() { _generic_package_kernel-headers; }"
eval "package_$pkgbase-docs() { _generic_package_linux-docs; }" eval "package_$pkgbase-docs() { _generic_package_kernel-docs; }"
############################## ##############################
@ -223,7 +250,7 @@ build() {
# Stop after configuration if desired # Stop after configuration if desired
####################################### #######################################
if [[ -n $_configure_only ]]; then if [[ -n $_configure_only ]]; then
rm -rf "$srcdir" "$pkgdir" rm -rf "$_kernel_src" "$srcdir" "$pkgdir"
return 1 return 1
fi fi
@ -241,18 +268,6 @@ build() {
fi fi
####################################
# Append pkgrel to kernel version
####################################
sed -ri "s/^(EXTRAVERSION =).*$/\1 -$pkgrel/" Makefile
####################################
# don't run depmod on 'make install'
####################################
sed -i '2iexit 0' scripts/depmod.sh
git update-index --assume-unchanged scripts/depmod.sh
################# #################
# BUILD PROCESS # BUILD PROCESS
@ -267,11 +282,24 @@ if [[ -n $_make_modules ]]; then
else else
make $MAKEFLAGS V="$_verbose" bzImage make $MAKEFLAGS V="$_verbose" bzImage
fi fi
############
# CLEANUP
############
###################################
# Copy files from build directory
####################################
# if (( ! CLEANUP )) && [[ $_build_dir != $srcdir ]]; then
# msg "Saving $_kernel_src to $srcdir/${_kernel_src##*/}..."
# mv "$_kernel_src" "$srcdir"
# rm -rf "$_kernel_src"
# fi
} }
_generic_package_initialization() { _generic_package_initialization() {
cd "$srcdir/${_kernel_src##*/}" cd "$_kernel_src"
_karch="x86" _karch="x86"
@ -279,11 +307,21 @@ _generic_package_initialization() {
# Get kernel version # Get kernel version
###################### ######################
_kernver=$(make kernelrelease) _kernver=$(make kernelrelease)
_basekernver=${_kernver%%-*} _basekernel=${_kernver%%-*}
############################################################
# Use kernel version instead of the current date as pkgver
############################################################
if [[ -n $_kernel_pkgver ]]; then
pkgver=${_kernver//-/_}
msg "Setting pkgver to kernel version: $pkgver"
fi
} }
_generic_package_linux() { _generic_package_kernel() {
pkgdesc="The Linux Kernel and modules from Linus' git tree" pkgdesc="The Linux Kernel and modules from Linus' git tree"
depends=('coreutils' 'linux-firmware' 'module-init-tools' 'mkinitcpio')
backup=(etc/mkinitcpio.d/$pkgname.preset) backup=(etc/mkinitcpio.d/$pkgname.preset)
install=$pkgname.install install=$pkgname.install
changelog=$pkgname.changelog changelog=$pkgname.changelog
@ -314,20 +352,10 @@ _generic_package_linux() {
########################## ##########################
msg "Installing kernel modules..." msg "Installing kernel modules..."
if [[ -n $_make_modules ]]; then if [[ -n $_make_modules ]]; then
# force -j1 to work around make 3.82 bug make INSTALL_MOD_PATH="$pkgdir" modules_install
make -j1 INSTALL_MOD_PATH="$pkgdir/usr" modules_install fi
[[ -z $_no_modules_compression ]] && find "$pkgdir" -name "*.ko" -exec gzip -9 {} + [[ -z $_no_modules_compression ]] && find "$pkgdir" -name "*.ko" -exec gzip -9 {} +
#########################################################
# Set up extramodules directory (for external modules)
#########################################################
local extramodules="$pkgdir/usr/lib/modules/extramodules-$(cut -d. -f1,2 <<<$_basekernver)"
local modversion=$(grep '^CONFIG_LOCALVERSION=' .config | cut -d'"' -f2)
[[ -n $modversion ]] && extramodules+=$modversion
install -dm755 "${extramodules}${_pkgext}"
echo $_kernver > "${extramodules}${_pkgext}/version"
ln -s "../${extramodules##*/}${_pkgext}" "$pkgdir/usr/lib/modules/$_kernver/extramodules"
################################## ##################################
# Create important symlinks # Create important symlinks
@ -335,17 +363,18 @@ _generic_package_linux() {
msg "Creating important symlinks..." msg "Creating important symlinks..."
# Create generic modules symlink # Create generic modules symlink
if [[ $_kernver != ${_basekernver}${_pkgext} ]]; then
cd "$pkgdir/usr/lib/modules" if [[ $_kernver != ${_basekernel}${_pkgext} ]]; then
ln -s "$_kernver" "${_basekernver}${_pkgext}" cd "$pkgdir/lib/modules"
ln -s "$_kernver" "${_basekernel}${_pkgext}"
cd "$OLDPWD" cd "$OLDPWD"
fi fi
# remove header symlinks # remove header symlinks
cd "$pkgdir/usr/lib/modules/$_kernver" cd "$pkgdir/lib/modules/$_kernver"
rm -rf source build rm -rf source build
cd "$OLDPWD" cd "$OLDPWD"
fi
############################ ############################
@ -355,7 +384,8 @@ _generic_package_linux() {
msg "Generating $pkgname.preset..." msg "Generating $pkgname.preset..."
cat > "$pkgdir/etc/mkinitcpio.d/$pkgname.preset" <<EOF cat > "$pkgdir/etc/mkinitcpio.d/$pkgname.preset" <<EOF
# mkinitcpio preset file for the '$pkgname' package # mkinitcpio preset file for $pkgname
ALL_config="/etc/mkinitcpio.conf" ALL_config="/etc/mkinitcpio.conf"
ALL_kver="/boot/vmlinuz-$pkgname" ALL_kver="/boot/vmlinuz-$pkgname"
@ -368,6 +398,11 @@ COMPRESSION="lz4" # since kernel 2.6.34
EOF EOF
msg "Generating $pkgname.kver..."
echo -e "# DO NOT EDIT THIS FILE\nALL_kver='$_kernver'" \
> "$pkgdir/etc/mkinitcpio.d/$pkgname.kver"
####################### #######################
# Update install file # Update install file
@ -377,24 +412,24 @@ EOF
sed -ri "s/^(kernver=).*$/\1$_kernver/" "$startdir/$pkgname.install" sed -ri "s/^(kernver=).*$/\1$_kernver/" "$startdir/$pkgname.install"
####################### #######################
# Remove the firmware # Remove the firmware
####################### #######################
rm -rf "$pkgdir/usr/lib/firmware"
# remove the firmware
rm -rf "${pkgdir}/lib/firmware"
# Now we call depmod...
depmod -b "${pkgdir}" -F System.map "${_kernver}"
# move module tree /lib -> /usr/lib
mkdir -p "${pkgdir}/usr"
mv "${pkgdir}/lib" "${pkgdir}/usr/"
#######################
# Run depmod
#######################
if [[ -n $_make_modules ]]; then
depmod -a "$pkgdir/usr"
depmod -b "$pkgdir/usr" -F System.map "$_kernver"
fi
} }
_generic_package_kernel-headers() {
_generic_package_linux-headers() {
pkgdesc="Header files and scripts for building modules for $pkgbase" pkgdesc="Header files and scripts for building modules for $pkgbase"
depends=("$pkgbase") depends=("$pkgbase")
@ -414,10 +449,10 @@ _generic_package_linux-headers() {
install -Dm644 Module.symvers "$pkgdir/usr/src/linux-$_kernver/Module.symvers" install -Dm644 Module.symvers "$pkgdir/usr/src/linux-$_kernver/Module.symvers"
install -Dm644 Makefile "$pkgdir/usr/src/linux-$_kernver/Makefile" install -Dm644 Makefile "$pkgdir/usr/src/linux-$_kernver/Makefile"
install -Dm644 kernel/Makefile "$pkgdir/usr/src/linux-$_kernver/kernel/Makefile" install -Dm644 kernel/Makefile "$pkgdir/usr/src/linux-$_kernver/kernel/Makefile"
install -Dm644 .config "$pkgdir/usr/src/linux-$_kernver/.config"
install -Dm644 .config "$pkgdir/usr/lib/modules/$_kernver/.config" install -Dm644 .config "$pkgdir/usr/lib/modules/$_kernver/.config"
####################################################### #######################################################
# Install scripts directory and fix permissions on it # Install scripts directory and fix permissions on it
####################################################### #######################################################
@ -430,7 +465,7 @@ _generic_package_linux-headers() {
msg "Installing header files..." msg "Installing header files..."
for i in net/ipv4/netfilter/ipt_CLUSTERIP.c \ for i in net/ipv4/netfilter/ipt_CLUSTERIP.c \
$(find include/ net/mac80211/ drivers/md -iname "*.h") \ $(find include/ net/mac80211/ drivers/{md,media/video/} -iname "*.h") \
$(find include/config/ -type f) \ $(find include/config/ -type f) \
$(find . -name "Kconfig*") $(find . -name "Kconfig*")
do do
@ -497,12 +532,12 @@ _generic_package_linux-headers() {
if [[ $_kernver != ${_basekernver}${_pkgext} ]]; then if [[ $_kernver != ${_basekernver}${_pkgext} ]]; then
cd "$pkgdir/usr/src" cd "$pkgdir/usr/src"
ln -s "linux-$_kernver" "linux-${_basekernver}${_pkgext}" ln -s "linux-$_kernver" "linux-${_basekernel}${_pkgext}"
cd "$OLDPWD" cd "$OLDPWD"
fi fi
} }
_generic_package_linux-docs() { _generic_package_kernel-docs() {
pkgdesc="Kernel hackers manual - HTML documentation that comes with the Linux kernel." pkgdesc="Kernel hackers manual - HTML documentation that comes with the Linux kernel."
depends=("$pkgbase") depends=("$pkgbase")
@ -510,7 +545,8 @@ _generic_package_linux-docs() {
_generic_package_initialization _generic_package_initialization
mkdir -p "$pkgdir/usr/src/linux-$_kernver" mkdir -p "$pkgdir/usr/src/linux-$_kernver"
cp -aL Documentation "$pkgdir/usr/src/linux-$_kernver/" cp -a Documentation "$pkgdir/usr/src/linux-$_kernver/"
} }
# vim: set fenc=utf-8 ts=2 sw=2 noet: # vim: set fenc=utf-8 ts=2 sw=2 noet:

File diff suppressed because it is too large Load Diff

4483
config.saved.x86_64_static Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
pkgname=linux-spica pkgname=linux-spica
kernver=4.8.12-1spica-dirty kernver=4.8.12spica-4.9.rc7-dirty
#bootdevice="BOOT_IMAGE=/boot/vmlinuz-$pkgname root=UUID=d670564f-2cb3-4981-9d51-6ed9c1327d47" #bootdevice="BOOT_IMAGE=/boot/vmlinuz-$pkgname root=UUID=d670564f-2cb3-4981-9d51-6ed9c1327d47"
#option="rw quiet clocksource=hpet initrd=EFI/spi-ca/initrd intel_iommu=on pci-stub.ids=1002:683f,1002:aab0 vfio_iommu_type1.allow_unsafe_interrupts=1,kvm.ignore_msrs=1" #option="rw quiet clocksource=hpet initrd=EFI/spi-ca/initrd intel_iommu=on pci-stub.ids=1002:683f,1002:aab0 vfio_iommu_type1.allow_unsafe_interrupts=1,kvm.ignore_msrs=1"
#option="rw quiet clocksource=hpet initrd=EFI/spi-ca/initrd quiet intremap=no_x2apic_optout zswap.enabled=1 zswap.max_pool_percent=25 zswap.compressor=lz4" #option="rw quiet clocksource=hpet initrd=EFI/spi-ca/initrd quiet intremap=no_x2apic_optout zswap.enabled=1 zswap.max_pool_percent=25 zswap.compressor=lz4"

31
patches/apple-gmux.patch Normal file
View File

@ -0,0 +1,31 @@
--- a/drivers/platform/x86/apple-gmux.c
+++ a/drivers/platform/x86/apple-gmux.c
@@ -419,6 +419,7 @@ static int gmux_resume(struct device *dev)
static struct pci_dev *gmux_get_io_pdev(void)
{
+ struct pci_dev *igp = NULL, *dgp = NULL;
struct pci_dev *pdev = NULL;
while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev))) {
@@ -428,10 +429,18 @@ static struct pci_dev *gmux_get_io_pdev(void)
if (!(cmd & PCI_COMMAND_IO))
continue;
- return pdev;
+ if (pdev->bus && pdev->bus->number > 0 && !dgp)
+ dgp = pci_dev_get(pdev);
+ else if (pdev->bus && pdev->bus->number == 0 && !igp)
+ igp = pci_dev_get(pdev);
}
- return NULL;
+ if (dgp && !igp)
+ pr_warn("Found only discrete GPU %s, integrated GPU is hidden,"
+ " unable to protect backlight behind VGA IO",
+ pci_name(dgp));
+ pci_dev_put(dgp);
+ return igp;
}
static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)

View File

@ -0,0 +1,11 @@
--- linux-3.16/include/linux/printk.h.old 2014-08-04 18:48:30.686043266 +0200
+++ linux-3.16/include/linux/printk.h 2014-08-04 18:48:47.706218528 +0200
@@ -37,7 +37,7 @@
#define CONSOLE_LOGLEVEL_SILENT 0 /* Mum's the word */
#define CONSOLE_LOGLEVEL_MIN 1 /* Minimum loglevel we let people use */
#define CONSOLE_LOGLEVEL_QUIET 4 /* Shhh ..., when booted with "quiet" */
-#define CONSOLE_LOGLEVEL_DEFAULT 7 /* anything MORE serious than KERN_DEBUG */
+#define CONSOLE_LOGLEVEL_DEFAULT 4 /* anything MORE serious than KERN_DEBUG */
#define CONSOLE_LOGLEVEL_DEBUG 10 /* issue debug messages */
#define CONSOLE_LOGLEVEL_MOTORMOUTH 15 /* You can't shut this one up */

View File

@ -0,0 +1,148 @@
--- linux-4.8/drivers/cpufreq/intel_pstate.c.orig 2016-10-02 19:24:33.000000000 -0400
+++ linux-4.8/drivers/cpufreq/intel_pstate.c 2016-10-09 19:32:01.073141319 -0400
@@ -181,6 +181,8 @@
* @cpu: CPU number for this instance data
* @update_util: CPUFreq utility callback information
* @update_util_set: CPUFreq utility callback is set
+ * @iowait_boost: iowait-related boost fraction
+ * @last_update: Time of the last update.
* @pstate: Stores P state limits for this CPU
* @vid: Stores VID limits for this CPU
* @pid: Stores PID parameters for this CPU
@@ -206,6 +208,7 @@
struct vid_data vid;
struct _pid pid;
+ u64 last_update;
u64 last_sample_time;
u64 prev_aperf;
u64 prev_mperf;
@@ -216,6 +219,7 @@
struct acpi_processor_performance acpi_perf_data;
bool valid_pss_table;
#endif
+ unsigned int iowait_boost;
};
static struct cpudata **all_cpu_data;
@@ -229,6 +233,7 @@
* @p_gain_pct: PID proportional gain
* @i_gain_pct: PID integral gain
* @d_gain_pct: PID derivative gain
+ * @boost_iowait: Whether or not to use iowait boosting.
*
* Stores per CPU model static PID configuration data.
*/
@@ -240,6 +245,7 @@
int p_gain_pct;
int d_gain_pct;
int i_gain_pct;
+ bool boost_iowait;
};
/**
@@ -1029,7 +1035,7 @@
},
};
-static struct cpu_defaults silvermont_params = {
+static const struct cpu_defaults silvermont_params = {
.pid_policy = {
.sample_rate_ms = 10,
.deadband = 0,
@@ -1037,6 +1043,7 @@
.p_gain_pct = 14,
.d_gain_pct = 0,
.i_gain_pct = 4,
+ .boost_iowait = true,
},
.funcs = {
.get_max = atom_get_max_pstate,
@@ -1050,7 +1057,7 @@
},
};
-static struct cpu_defaults airmont_params = {
+static const struct cpu_defaults airmont_params = {
.pid_policy = {
.sample_rate_ms = 10,
.deadband = 0,
@@ -1058,6 +1065,7 @@
.p_gain_pct = 14,
.d_gain_pct = 0,
.i_gain_pct = 4,
+ .boost_iowait = true,
},
.funcs = {
.get_max = atom_get_max_pstate,
@@ -1071,7 +1079,7 @@
},
};
-static struct cpu_defaults knl_params = {
+static const struct cpu_defaults knl_params = {
.pid_policy = {
.sample_rate_ms = 10,
.deadband = 0,
@@ -1091,7 +1099,7 @@
},
};
-static struct cpu_defaults bxt_params = {
+static const struct cpu_defaults bxt_params = {
.pid_policy = {
.sample_rate_ms = 10,
.deadband = 0,
@@ -1099,6 +1107,7 @@
.p_gain_pct = 14,
.d_gain_pct = 0,
.i_gain_pct = 4,
+ .boost_iowait = true,
},
.funcs = {
.get_max = core_get_max_pstate,
@@ -1222,36 +1231,18 @@
static inline int32_t get_target_pstate_use_cpu_load(struct cpudata *cpu)
{
struct sample *sample = &cpu->sample;
- u64 cummulative_iowait, delta_iowait_us;
- u64 delta_iowait_mperf;
- u64 mperf, now;
- int32_t cpu_load;
+ int32_t busy_frac, boost;
- cummulative_iowait = get_cpu_iowait_time_us(cpu->cpu, &now);
+ busy_frac = div_fp(sample->mperf, sample->tsc);
- /*
- * Convert iowait time into number of IO cycles spent at max_freq.
- * IO is considered as busy only for the cpu_load algorithm. For
- * performance this is not needed since we always try to reach the
- * maximum P-State, so we are already boosting the IOs.
- */
- delta_iowait_us = cummulative_iowait - cpu->prev_cummulative_iowait;
- delta_iowait_mperf = div64_u64(delta_iowait_us * cpu->pstate.scaling *
- cpu->pstate.max_pstate, MSEC_PER_SEC);
-
- mperf = cpu->sample.mperf + delta_iowait_mperf;
- cpu->prev_cummulative_iowait = cummulative_iowait;
+ boost = cpu->iowait_boost;
+ cpu->iowait_boost >>= 1;
- /*
- * The load can be estimated as the ratio of the mperf counter
- * running at a constant frequency during active periods
- * (C0) and the time stamp counter running at the same frequency
- * also during C-states.
- */
- cpu_load = div64_u64(int_tofp(100) * mperf, sample->tsc);
- cpu->sample.busy_scaled = cpu_load;
+ if (busy_frac < boost)
+ busy_frac = boost;
- return get_avg_pstate(cpu) - pid_calc(&cpu->pid, cpu_load);
+ sample->busy_scaled = busy_frac * 100;
+ return get_avg_pstate(cpu) - pid_calc(&cpu->pid, sample->busy_scaled);
}
static inline int32_t get_target_pstate_use_performance(struct cpudata *cpu)

View File

@ -0,0 +1,123 @@
--- linux_for_test.orig/scripts/mod/modpost.c 2016-04-21 17:01:42.917757676 +0800
+++ linux_for_test.orig/scripts/mod/modpost.c 2016-05-29 13:32:41.266916072 +0800
@@ -877,6 +877,7 @@
#define ALL_PCI_INIT_SECTIONS \
".pci_fixup_early", ".pci_fixup_header", ".pci_fixup_final", \
+ ".pci_fixup_assign", \
".pci_fixup_enable", ".pci_fixup_resume", \
".pci_fixup_resume_early", ".pci_fixup_suspend"
--- linux_for_test.orig/include/asm-generic/vmlinux.lds.h 2016-05-18 13:14:13.970951863 +0800
+++ linux_for_test.orig/include/asm-generic/vmlinux.lds.h 2016-05-29 13:32:24.870916334 +0800
@@ -283,6 +283,9 @@
VMLINUX_SYMBOL(__start_pci_fixups_final) = .; \
*(.pci_fixup_final) \
VMLINUX_SYMBOL(__end_pci_fixups_final) = .; \
+ VMLINUX_SYMBOL(__start_pci_fixups_assign) = .; \
+ *(.pci_fixup_assign) \
+ VMLINUX_SYMBOL(__end_pci_fixups_assign) = .; \
VMLINUX_SYMBOL(__start_pci_fixups_enable) = .; \
*(.pci_fixup_enable) \
VMLINUX_SYMBOL(__end_pci_fixups_enable) = .; \
--- linux_for_test.orig/include/linux/pci.h 2016-05-29 12:51:02.000000000 +0800
+++ linux_for_test.orig/include/linux/pci.h 2016-05-29 13:39:20.926909684 +0800
@@ -1584,6 +1584,7 @@
pci_fixup_early, /* Before probing BARs */
pci_fixup_header, /* After reading configuration header */
pci_fixup_final, /* Final phase of device fixups */
+ pci_fixup_assign, /* Before resource assignment */
pci_fixup_enable, /* pci_enable_device() time */
pci_fixup_resume, /* pci_device_resume() */
pci_fixup_suspend, /* pci_device_suspend() */
@@ -1644,6 +1645,9 @@
#define DECLARE_PCI_FIXUP_FINAL(vendor, device, hook) \
DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final, \
hook, vendor, device, PCI_ANY_ID, 0, hook)
+#define DECLARE_PCI_FIXUP_ASSIGN(vendor, device, hook) \
+ DECLARE_PCI_FIXUP_SECTION(.pci_fixup_assign, \
+ hook, vendor, device, PCI_ANY_ID, 0, hook)
#define DECLARE_PCI_FIXUP_ENABLE(vendor, device, hook) \
DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \
hook, vendor, device, PCI_ANY_ID, 0, hook)
--- linux_for_test.orig/drivers/pci/quirks.c 2016-05-27 13:20:01.114516646 +0800
+++ linux_for_test.orig/drivers/pci/quirks.c 2016-05-29 16:07:58.230767144 +0800
@@ -3370,6 +3370,8 @@
extern struct pci_fixup __end_pci_fixups_header[];
extern struct pci_fixup __start_pci_fixups_final[];
extern struct pci_fixup __end_pci_fixups_final[];
+extern struct pci_fixup __start_pci_fixups_assign[];
+extern struct pci_fixup __end_pci_fixups_assign[];
extern struct pci_fixup __start_pci_fixups_enable[];
extern struct pci_fixup __end_pci_fixups_enable[];
extern struct pci_fixup __start_pci_fixups_resume[];
@@ -3405,6 +3407,11 @@
end = __end_pci_fixups_final;
break;
+ case pci_fixup_assign:
+ start = __start_pci_fixups_assign;
+ end = __end_pci_fixups_assign;
+ break;
+
case pci_fixup_enable:
start = __start_pci_fixups_enable;
end = __end_pci_fixups_enable;
@@ -4419,3 +4426,30 @@
}
}
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x443, quirk_intel_qat_vf_cap);
+
+static int disable_mode;
+/* On Mac Pro 11, mem allocation broke ACPI Sleep Type register region. */
+static void quirk_disable_mmio_bar(struct pci_dev *dev)
+{
+ struct resource *b_res;
+
+ dev_info(&dev->dev, "[Quirk] Disable mmio regions for Mac Pro 11\n");
+ if ((dev->class >> 8) != PCI_CLASS_BRIDGE_PCI)
+ return;
+
+ b_res = &dev->resource[PCI_BRIDGE_RESOURCES];
+ b_res[1].flags = 0;
+
+ if (disable_mode & 1) {
+ b_res[2].flags = 0;
+ }
+
+}
+DECLARE_PCI_FIXUP_ASSIGN(PCI_VENDOR_ID_INTEL, 0x8c10, quirk_disable_mmio_bar);
+
+static int __init parse_disable_mode(char *str)
+{
+ get_option(&str, &disable_mode);
+ return 0;
+}
+early_param("disable_mode", parse_disable_mode);
--- linux_for_test.orig/drivers/pci/setup-bus.c 2016-05-29 12:26:08.000000000 +0800
+++ linux_for_test.orig/drivers/pci/setup-bus.c 2016-05-29 13:58:36.086891219 +0800
@@ -1256,6 +1256,8 @@
additional_io_size = pci_hotplug_io_size;
additional_mem_size = pci_hotplug_mem_size;
}
+
+ pci_fixup_device(pci_fixup_assign, bus->self);
/* Fall through */
default:
pbus_size_io(bus, realloc_head ? 0 : additional_io_size,
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -2775,6 +2775,13 @@ static void quirk_hotplug_bridge(struct pci_dev *dev)
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_HINT, 0x0020, quirk_hotplug_bridge);
+static void quirk_hotplug_bridge_skip(struct pci_dev *dev)
+{
+ dev->is_hotplug_bridge = 0;
+}
+
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x8c10, quirk_hotplug_bridge_skip);
+
/*
* This is a quirk for the Ricoh MMC controller found as a part of
* some mulifunction chips.

View File

@ -0,0 +1,32 @@
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 37ff015..47b303a 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -2776,6 +2776,27 @@ static void quirk_hotplug_bridge(struct pci_dev *dev)
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_HINT, 0x0020, quirk_hotplug_bridge);
/*
+ * Apple: Avoid programming the memory/io aperture of 00:1c.0
+ *
+ * BIOS does not declare any resource for 00:1c.0, but with
+ * hotplug flag set, thus OS allocate:
+ * [mem 0x7fa00000 - 0x7fbfffff]
+ * [mem 0x7fc00000-0x7fdfffff 64bit pref]
+ * which is conflict with an unreported device, which
+ * causes unpredictable result such as accessing io port.
+ * So clear the hotplug flag to work around it.
+ */
+static void quirk_apple_mbp_poweroff(struct pci_dev *dev)
+{
+ if (dmi_match(DMI_BOARD_VENDOR, "Apple Inc.") &&
+ dmi_match(DMI_PRODUCT_NAME, "MacBookPro11,4") ||
+ dmi_match(DMI_PRODUCT_NAME, "MacBookPro11,5"))
+ dev->is_hotplug_bridge = 0;
+}
+
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x8c10, quirk_apple_mbp_poweroff);
+
+/*
* This is a quirk for the Ricoh MMC controller found as a part of
* some mulifunction chips.