Message ID | 1499698794-1718-3-git-send-email-deathsimple@vodafone.de (mailing list archive) |
---|---|
State | New, archived |
Delegated to: | Bjorn Helgaas |
Headers | show |
Hi Christian, [auto build test WARNING on pci/next] [also build test WARNING on v4.12 next-20170710] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Christian-K-nig/PCI-add-a-define-for-the-PCI-resource-type-mask-v2/20170711-104904 base: https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next reproduce: make htmldocs All warnings (new ones prefixed by >>): WARNING: convert(1) not found, for SVG to PDF conversion install ImageMagick (https://www.imagemagick.org) arch/x86/include/asm/uaccess_32.h:1: warning: no structured comments found include/linux/init.h:1: warning: no structured comments found include/linux/mod_devicetable.h:687: warning: Excess struct/union/enum/typedef member 'ver_major' description in 'fsl_mc_device_id' include/linux/mod_devicetable.h:687: warning: Excess struct/union/enum/typedef member 'ver_minor' description in 'fsl_mc_device_id' kernel/sched/core.c:2080: warning: No description found for parameter 'rf' kernel/sched/core.c:2080: warning: Excess function parameter 'cookie' description in 'try_to_wake_up_local' include/linux/wait.h:555: warning: No description found for parameter 'wq' include/linux/wait.h:555: warning: Excess function parameter 'wq_head' description in 'wait_event_interruptible_hrtimeout' include/linux/wait.h:759: warning: No description found for parameter 'wq_head' include/linux/wait.h:759: warning: Excess function parameter 'wq' description in 'wait_event_killable' include/linux/kthread.h:26: warning: Excess function parameter '...' description in 'kthread_create' kernel/sys.c:1: warning: no structured comments found Error: Cannot open file kernel/rcu/srcu.c Error: Cannot open file kernel/rcu/srcu.c WARNING: kernel-doc 'scripts/kernel-doc -rst -enable-lineno -export kernel/rcu/srcu.c' failed with return code 2 include/linux/device.h:968: warning: No description found for parameter 'dma_ops' drivers/dma-buf/seqno-fence.c:1: warning: no structured comments found include/linux/iio/iio.h:603: warning: No description found for parameter 'trig_readonly' include/linux/iio/trigger.h:151: warning: No description found for parameter 'indio_dev' include/linux/iio/trigger.h:151: warning: No description found for parameter 'trig' include/linux/device.h:969: warning: No description found for parameter 'dma_ops' drivers/ata/libata-eh.c:1449: warning: No description found for parameter 'link' drivers/ata/libata-eh.c:1449: warning: Excess function parameter 'ap' description in 'ata_eh_done' drivers/ata/libata-eh.c:1590: warning: No description found for parameter 'qc' drivers/ata/libata-eh.c:1590: warning: Excess function parameter 'dev' description in 'ata_eh_request_sense' >> drivers/pci/pci.c:2970: warning: No description found for parameter 'pdev' >> drivers/pci/pci.c:2970: warning: Excess function parameter 'dev' description in 'pci_rbar_find_pos' drivers/pci/pci.c:3004: warning: No description found for parameter 'pdev' >> drivers/pci/pci.c:3004: warning: Excess function parameter 'dev' description in 'pci_rbar_get_possible_sizes' drivers/pci/pci.c:3026: warning: No description found for parameter 'pdev' >> drivers/pci/pci.c:3026: warning: Excess function parameter 'dev' description in 'pci_rbar_get_current_size' drivers/pci/pci.c:3049: warning: No description found for parameter 'pdev' >> drivers/pci/pci.c:3049: warning: Excess function parameter 'dev' description in 'pci_rbar_set_size' arch/s390/include/asm/cmb.h:1: warning: no structured comments found drivers/scsi/scsi_lib.c:1116: warning: No description found for parameter 'rq' drivers/scsi/constants.c:1: warning: no structured comments found include/linux/usb/gadget.h:230: warning: No description found for parameter 'claimed' include/linux/usb/gadget.h:230: warning: No description found for parameter 'enabled' include/linux/usb/gadget.h:412: warning: No description found for parameter 'quirk_altset_not_supp' include/linux/usb/gadget.h:412: warning: No description found for parameter 'quirk_stall_not_supp' include/linux/usb/gadget.h:412: warning: No description found for parameter 'quirk_zlp_not_supp' fs/inode.c:1666: warning: No description found for parameter 'rcu' include/linux/jbd2.h:443: warning: No description found for parameter 'i_transaction' include/linux/jbd2.h:443: warning: No description found for parameter 'i_next_transaction' include/linux/jbd2.h:443: warning: No description found for parameter 'i_list' include/linux/jbd2.h:443: warning: No description found for parameter 'i_vfs_inode' include/linux/jbd2.h:443: warning: No description found for parameter 'i_flags' include/linux/jbd2.h:497: warning: No description found for parameter 'h_rsv_handle' include/linux/jbd2.h:497: warning: No description found for parameter 'h_reserved' include/linux/jbd2.h:497: warning: No description found for parameter 'h_type' include/linux/jbd2.h:497: warning: No description found for parameter 'h_line_no' include/linux/jbd2.h:497: warning: No description found for parameter 'h_start_jiffies' include/linux/jbd2.h:497: warning: No description found for parameter 'h_requested_credits' include/linux/jbd2.h:497: warning: No description found for parameter 'saved_alloc_context' include/linux/jbd2.h:1050: warning: No description found for parameter 'j_chkpt_bhs' include/linux/jbd2.h:1050: warning: No description found for parameter 'j_devname' include/linux/jbd2.h:1050: warning: No description found for parameter 'j_average_commit_time' include/linux/jbd2.h:1050: warning: No description found for parameter 'j_min_batch_time' include/linux/jbd2.h:1050: warning: No description found for parameter 'j_max_batch_time' include/linux/jbd2.h:1050: warning: No description found for parameter 'j_commit_callback' include/linux/jbd2.h:1050: warning: No description found for parameter 'j_failed_commit' include/linux/jbd2.h:1050: warning: No description found for parameter 'j_chksum_driver' include/linux/jbd2.h:1050: warning: No description found for parameter 'j_csum_seed' fs/jbd2/transaction.c:511: warning: No description found for parameter 'type' fs/jbd2/transaction.c:511: warning: No description found for parameter 'line_no' fs/jbd2/transaction.c:641: warning: No description found for parameter 'gfp_mask' include/drm/drm_drv.h:537: warning: No description found for parameter 'set_busid' include/drm/drm_drv.h:537: warning: No description found for parameter 'debugfs_init' include/drm/drm_drv.h:537: warning: No description found for parameter 'gem_open_object' include/drm/drm_drv.h:537: warning: No description found for parameter 'gem_close_object' include/drm/drm_drv.h:537: warning: No description found for parameter 'prime_handle_to_fd' include/drm/drm_drv.h:537: warning: No description found for parameter 'prime_fd_to_handle' include/drm/drm_drv.h:537: warning: No description found for parameter 'gem_prime_export' include/drm/drm_drv.h:537: warning: No description found for parameter 'gem_prime_import' include/drm/drm_drv.h:537: warning: No description found for parameter 'gem_prime_pin' include/drm/drm_drv.h:537: warning: No description found for parameter 'gem_prime_unpin' include/drm/drm_drv.h:537: warning: No description found for parameter 'gem_prime_res_obj' include/drm/drm_drv.h:537: warning: No description found for parameter 'gem_prime_get_sg_table' include/drm/drm_drv.h:537: warning: No description found for parameter 'gem_prime_import_sg_table' include/drm/drm_drv.h:537: warning: No description found for parameter 'gem_prime_vmap' include/drm/drm_drv.h:537: warning: No description found for parameter 'gem_prime_vunmap' include/drm/drm_drv.h:537: warning: No description found for parameter 'gem_prime_mmap' include/drm/drm_drv.h:537: warning: No description found for parameter 'gem_vm_ops' include/drm/drm_drv.h:537: warning: No description found for parameter 'major' include/drm/drm_drv.h:537: warning: No description found for parameter 'minor' include/drm/drm_drv.h:537: warning: No description found for parameter 'patchlevel' include/drm/drm_drv.h:537: warning: No description found for parameter 'name' include/drm/drm_drv.h:537: warning: No description found for parameter 'desc' include/drm/drm_drv.h:537: warning: No description found for parameter 'date' include/drm/drm_drv.h:537: warning: No description found for parameter 'driver_features' include/drm/drm_drv.h:537: warning: No description found for parameter 'ioctls' include/drm/drm_drv.h:537: warning: No description found for parameter 'num_ioctls' include/drm/drm_drv.h:537: warning: No description found for parameter 'fops' include/drm/drm_color_mgmt.h:1: warning: no structured comments found drivers/gpu/drm/drm_syncobj.c:341: warning: Excess function parameter 'dev' description in 'drm_syncobj_open' drivers/gpu/drm/drm_syncobj.c:366: warning: Excess function parameter 'dev' description in 'drm_syncobj_release' include/drm/drm_syncobj.h:1: warning: no structured comments found drivers/gpu/drm/drm_syncobj.c:342: warning: Excess function parameter 'dev' description in 'drm_syncobj_open' drivers/gpu/drm/drm_syncobj.c:367: warning: Excess function parameter 'dev' description in 'drm_syncobj_release' drivers/gpu/host1x/bus.c:50: warning: Excess function parameter 'driver' description in 'host1x_subdev_add' include/net/sock.h:479: warning: No description found for parameter 'sk_tsq_flags' include/net/sock.h:479: warning: No description found for parameter '__sk_flags_offset' include/net/sock.h:479: warning: No description found for parameter 'sk_uid' Documentation/doc-guide/sphinx.rst:121: ERROR: Unknown target name: "sphinx c domain". kernel/sched/fair.c:7584: WARNING: Inline emphasis start-string without end-string. kernel/time/timer.c:1200: ERROR: Unexpected indentation. kernel/time/timer.c:1202: ERROR: Unexpected indentation. kernel/time/timer.c:1203: WARNING: Block quote ends without a blank line; unexpected unindent. include/linux/wait.h:108: WARNING: Block quote ends without a blank line; unexpected unindent. include/linux/wait.h:111: ERROR: Unexpected indentation. include/linux/wait.h:113: WARNING: Block quote ends without a blank line; unexpected unindent. kernel/time/hrtimer.c:991: WARNING: Block quote ends without a blank line; unexpected unindent. kernel/signal.c:323: WARNING: Inline literal start-string without end-string. kernel/rcu/tree.c:3187: ERROR: Unexpected indentation. kernel/rcu/tree.c:3214: ERROR: Unexpected indentation. kernel/rcu/tree.c:3215: WARNING: Bullet list ends without a blank line; unexpected unindent. include/linux/iio/iio.h:219: ERROR: Unexpected indentation. include/linux/iio/iio.h:220: WARNING: Block quote ends without a blank line; unexpected unindent. include/linux/iio/iio.h:226: WARNING: Definition list ends without a blank line; unexpected unindent. drivers/iio/industrialio-core.c:633: ERROR: Unknown target name: "iio_val". drivers/iio/industrialio-core.c:640: ERROR: Unknown target name: "iio_val". drivers/ata/libata-core.c:5906: ERROR: Unknown target name: "hw". drivers/message/fusion/mptbase.c:5051: WARNING: Definition list ends without a blank line; unexpected unindent. drivers/tty/serial/serial_core.c:1897: WARNING: Definition list ends without a blank line; unexpected unindent. drivers/pci/pci.c:3574: ERROR: Unexpected indentation. include/linux/regulator/driver.h:271: ERROR: Unknown target name: "regulator_regmap_x_voltage". include/linux/spi/spi.h:373: ERROR: Unexpected indentation. drivers/w1/w1_io.c:196: WARNING: Definition list ends without a blank line; unexpected unindent. block/bio.c:407: ERROR: Unknown target name: "gfp". drivers/gpu/drm/drm_scdc_helper.c:203: ERROR: Unexpected indentation. drivers/gpu/drm/drm_scdc_helper.c:204: WARNING: Block quote ends without a blank line; unexpected unindent. drivers/gpu/drm/drm_ioctl.c:702: WARNING: Definition list ends without a blank line; unexpected unindent. Documentation/gpu/todo.rst:111: ERROR: Unknown target name: "drm_fb". vim +/pdev +2970 drivers/pci/pci.c 2958 2959 /** 2960 * pci_rbar_find_pos - find position of resize ctrl reg for BAR 2961 * @dev: PCI device 2962 * @bar: BAR to find 2963 * 2964 * Helper to find the postion of the ctrl register for a BAR. 2965 * Returns -ENOTSUPP of resizeable BARs are not supported at all. 2966 * Returns -ENOENT if not ctrl register for the BAR could be found. 2967 */ 2968 static int pci_rbar_find_pos(struct pci_dev *pdev, int bar) 2969 { > 2970 unsigned int pos, nbars; 2971 unsigned int i; 2972 u32 ctrl; 2973 2974 pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_REBAR); 2975 if (!pos) 2976 return -ENOTSUPP; 2977 2978 pci_read_config_dword(pdev, pos + PCI_REBAR_CTRL, &ctrl); 2979 nbars = (ctrl & PCI_REBAR_CTRL_NBAR_MASK) >> PCI_REBAR_CTRL_NBAR_SHIFT; 2980 2981 for (i = 0; i < nbars; ++i, pos += 8) { 2982 int bar_idx; 2983 2984 pci_read_config_dword(pdev, pos + PCI_REBAR_CTRL, &ctrl); 2985 bar_idx = (ctrl & PCI_REBAR_CTRL_BAR_IDX_MASK) >> 2986 PCI_REBAR_CTRL_BAR_IDX_SHIFT; 2987 if (bar_idx == bar) 2988 return pos; 2989 } 2990 2991 return -ENOENT; 2992 } 2993 2994 /** 2995 * pci_rbar_get_possible_sizes - get possible sizes for BAR 2996 * @dev: PCI device 2997 * @bar: BAR to query 2998 * 2999 * Get the possible sizes of a resizeable BAR as bitmask defined in the spec 3000 * (bit 0=1MB, bit 19=512GB). Returns 0 if BAR isn't resizeable. 3001 */ 3002 u32 pci_rbar_get_possible_sizes(struct pci_dev *pdev, int bar) 3003 { > 3004 u32 cap; 3005 int pos; 3006 3007 pos = pci_rbar_find_pos(pdev, bar); 3008 if (pos < 0) 3009 return 0; 3010 3011 pci_read_config_dword(pdev, pos + PCI_REBAR_CAP, &cap); 3012 return (cap & PCI_REBAR_CTRL_SIZES_MASK) >> 3013 PCI_REBAR_CTRL_SIZES_SHIFT; 3014 } 3015 3016 /** 3017 * pci_rbar_get_current_size - get the current size of a BAR 3018 * @dev: PCI device 3019 * @bar: BAR to set size to 3020 * 3021 * Read the size of a BAR from the resizeable BAR config. 3022 * Returns size if found or negative error code. 3023 */ 3024 int pci_rbar_get_current_size(struct pci_dev *pdev, int bar) 3025 { > 3026 u32 ctrl; 3027 int pos; 3028 3029 pos = pci_rbar_find_pos(pdev, bar); 3030 if (pos < 0) 3031 return pos; 3032 3033 pci_read_config_dword(pdev, pos + PCI_REBAR_CTRL, &ctrl); 3034 return (ctrl & PCI_REBAR_CTRL_BAR_SIZE_MASK) >> 3035 PCI_REBAR_CTRL_BAR_SIZE_SHIFT; 3036 } 3037 3038 /** 3039 * pci_rbar_set_size - set a new size for a BAR 3040 * @dev: PCI device 3041 * @bar: BAR to set size to 3042 * @size: new size as defined in the spec (0=1MB, 19=512GB) 3043 * 3044 * Set the new size of a BAR as defined in the spec. 3045 * Returns zero if resizing was successful, error code otherwise. 3046 */ 3047 int pci_rbar_set_size(struct pci_dev *pdev, int bar, int size) 3048 { > 3049 u32 ctrl; 3050 int pos; 3051 3052 pos = pci_rbar_find_pos(pdev, bar); 3053 if (pos < 0) 3054 return pos; 3055 3056 pci_read_config_dword(pdev, pos + PCI_REBAR_CTRL, &ctrl); 3057 ctrl &= ~PCI_REBAR_CTRL_BAR_SIZE_MASK; 3058 ctrl |= size << PCI_REBAR_CTRL_BAR_SIZE_SHIFT; 3059 pci_write_config_dword(pdev, pos + PCI_REBAR_CTRL, ctrl); 3060 return 0; 3061 } 3062 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index d88edf5..647b799 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -2957,6 +2957,110 @@ bool pci_acs_path_enabled(struct pci_dev *start, } /** + * pci_rbar_find_pos - find position of resize ctrl reg for BAR + * @dev: PCI device + * @bar: BAR to find + * + * Helper to find the postion of the ctrl register for a BAR. + * Returns -ENOTSUPP of resizeable BARs are not supported at all. + * Returns -ENOENT if not ctrl register for the BAR could be found. + */ +static int pci_rbar_find_pos(struct pci_dev *pdev, int bar) +{ + unsigned int pos, nbars; + unsigned int i; + u32 ctrl; + + pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_REBAR); + if (!pos) + return -ENOTSUPP; + + pci_read_config_dword(pdev, pos + PCI_REBAR_CTRL, &ctrl); + nbars = (ctrl & PCI_REBAR_CTRL_NBAR_MASK) >> PCI_REBAR_CTRL_NBAR_SHIFT; + + for (i = 0; i < nbars; ++i, pos += 8) { + int bar_idx; + + pci_read_config_dword(pdev, pos + PCI_REBAR_CTRL, &ctrl); + bar_idx = (ctrl & PCI_REBAR_CTRL_BAR_IDX_MASK) >> + PCI_REBAR_CTRL_BAR_IDX_SHIFT; + if (bar_idx == bar) + return pos; + } + + return -ENOENT; +} + +/** + * pci_rbar_get_possible_sizes - get possible sizes for BAR + * @dev: PCI device + * @bar: BAR to query + * + * Get the possible sizes of a resizeable BAR as bitmask defined in the spec + * (bit 0=1MB, bit 19=512GB). Returns 0 if BAR isn't resizeable. + */ +u32 pci_rbar_get_possible_sizes(struct pci_dev *pdev, int bar) +{ + u32 cap; + int pos; + + pos = pci_rbar_find_pos(pdev, bar); + if (pos < 0) + return 0; + + pci_read_config_dword(pdev, pos + PCI_REBAR_CAP, &cap); + return (cap & PCI_REBAR_CTRL_SIZES_MASK) >> + PCI_REBAR_CTRL_SIZES_SHIFT; +} + +/** + * pci_rbar_get_current_size - get the current size of a BAR + * @dev: PCI device + * @bar: BAR to set size to + * + * Read the size of a BAR from the resizeable BAR config. + * Returns size if found or negative error code. + */ +int pci_rbar_get_current_size(struct pci_dev *pdev, int bar) +{ + u32 ctrl; + int pos; + + pos = pci_rbar_find_pos(pdev, bar); + if (pos < 0) + return pos; + + pci_read_config_dword(pdev, pos + PCI_REBAR_CTRL, &ctrl); + return (ctrl & PCI_REBAR_CTRL_BAR_SIZE_MASK) >> + PCI_REBAR_CTRL_BAR_SIZE_SHIFT; +} + +/** + * pci_rbar_set_size - set a new size for a BAR + * @dev: PCI device + * @bar: BAR to set size to + * @size: new size as defined in the spec (0=1MB, 19=512GB) + * + * Set the new size of a BAR as defined in the spec. + * Returns zero if resizing was successful, error code otherwise. + */ +int pci_rbar_set_size(struct pci_dev *pdev, int bar, int size) +{ + u32 ctrl; + int pos; + + pos = pci_rbar_find_pos(pdev, bar); + if (pos < 0) + return pos; + + pci_read_config_dword(pdev, pos + PCI_REBAR_CTRL, &ctrl); + ctrl &= ~PCI_REBAR_CTRL_BAR_SIZE_MASK; + ctrl |= size << PCI_REBAR_CTRL_BAR_SIZE_SHIFT; + pci_write_config_dword(pdev, pos + PCI_REBAR_CTRL, ctrl); + return 0; +} + +/** * pci_swizzle_interrupt_pin - swizzle INTx for device behind bridge * @dev: the PCI device * @pin: the INTx pin (1=INTA, 2=INTB, 3=INTC, 4=INTD) diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 136a0f9..e494f1e 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -367,4 +367,12 @@ int acpi_get_rc_resources(struct device *dev, const char *hid, u16 segment, struct resource *res); #endif +u32 pci_rbar_get_possible_sizes(struct pci_dev *pdev, int bar); +int pci_rbar_get_current_size(struct pci_dev *pdev, int bar); +int pci_rbar_set_size(struct pci_dev *pdev, int bar, int size); +static inline u64 pci_rbar_size_to_bytes(int size) +{ + return 1ULL << (size + 20); +} + #endif /* DRIVERS_PCI_H */ diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h index c22d3eb..d6a075d 100644 --- a/include/uapi/linux/pci_regs.h +++ b/include/uapi/linux/pci_regs.h @@ -943,9 +943,16 @@ #define PCI_SATA_SIZEOF_LONG 16 /* Resizable BARs */ +#define PCI_REBAR_CAP 4 /* capability register */ +#define PCI_REBAR_CTRL_SIZES_MASK (0xFFFFF << 4) /* mask for sizes */ +#define PCI_REBAR_CTRL_SIZES_SHIFT 4 /* shift for sizes */ #define PCI_REBAR_CTRL 8 /* control register */ -#define PCI_REBAR_CTRL_NBAR_MASK (7 << 5) /* mask for # bars */ -#define PCI_REBAR_CTRL_NBAR_SHIFT 5 /* shift for # bars */ +#define PCI_REBAR_CTRL_BAR_IDX_MASK (7 << 0) /* mask for BAR index */ +#define PCI_REBAR_CTRL_BAR_IDX_SHIFT 0 /* shift for BAR index */ +#define PCI_REBAR_CTRL_NBAR_MASK (7 << 5) /* mask for # BARs */ +#define PCI_REBAR_CTRL_NBAR_SHIFT 5 /* shift for # BARs */ +#define PCI_REBAR_CTRL_BAR_SIZE_MASK (0x1F << 8) /* mask for BAR size */ +#define PCI_REBAR_CTRL_BAR_SIZE_SHIFT 8 /* shift for BAR size */ /* Dynamic Power Allocation */ #define PCI_DPA_CAP 4 /* capability register */